When the Ammonites saw that they had become a stench to David, Hanun and the Ammonites sent 1,000 talents of silver to hire chariots and horsemen from Mesopotamia, from Aram-maacah, and from Zobah. They hired 32,000 chariots and the king of Maacah with his army, who came and encamped before Medeba. And the Ammonites were mustered from their cities and came to battle. When David heard of it, he sent Joab and all the army of the mighty men. And the Ammonites came out and drew up in battle array at the entrance of the city, and the kings who had come were by themselves in the open country.
When Joab saw that the battle was set against him both in front and in the rear, he chose some of the best men of Israel and arrayed them against the Syrians. The rest of his men he put in the charge of Abishai his brother, and they were arrayed against the Ammonites. And he said, “If the Syrians are too strong for me, then you shall help me, but if the Ammonites are too strong for you, then I will help you. Be strong, and let us use our strength for our people and for the cities of our God, and may the LORD do what seems good to him.” So Joab and the people who were with him drew near before the Syrians for battle, and they fled before him. And when the Ammonites saw that the Syrians fled, they likewise fled before Abishai, Joab’s brother, and entered the city. Then Joab came to Jerusalem.
But when the Syrians saw that they had been defeated by Israel, they sent messengers and brought out the Syrians who were beyond the Euphrates, with Shophach the commander of the army of Hadadezer at their head. And when it was told to David, he gathered all Israel together and crossed the Jordan and came to them and drew up his forces against them. And when David set the battle in array against the Syrians, they fought with him. And the Syrians fled before Israel, and David killed of the Syrians the men of 7,000 chariots and 40,000 foot soldiers, and put to death also Shophach the commander of their army. And when the servants of Hadadezer saw that they had been defeated by Israel, they made peace with David and became subject to him. So the Syrians were not willing to save the Ammonites anymore.