Behold, I will put a spirit in him, so that he shall hear a rumor and return to his own land, and I will make him fall by the sword in his own land.
2 Kings 19:7

God often makes the proud to believe a lie which becomes their downfall. Sometimes the lie is about their own capabilities, causing an over-commitment, advancing when they should be withdrawing or consolidating. Sometimes it's something external as in this case, causing them to withdraw when they should advance.