Then David said, "I'll show kindness to Hanun son of Nahash, because his father showed kindness to me." So David sent messengers to console him concerning his father. However, when David's emissaries arrived in the land of the Ammonites to console him,
the Ammonite leaders said to Hanun, "Just because David has sent men with condolences for you, do you really believe he's showing respect for your father? Instead, hasn't David sent his emissaries in order to scout out, overthrow, and spy on the land?"
Someone came and reported to David about his men, so he sent [someone] to meet them, since the men were deeply humiliated. The king said, "Stay in Jericho until your beards grow back; then return."
When the Ammonites realized they had made themselves repulsive to David, Hanun and the Ammonites sent 38 tons of silver to hire chariots and horsemen from Aram-naharaim, Aram-maacah, and Zobah.
They hired 32,000 chariots and the king of Maacah with his army, who came and camped near Medeba. The Ammonites also gathered from their cities and came for the battle.
When Joab saw that there was a battle line in front of him and another behind him, he chose some men out of all the elite troops of Israel and lined up in battle formation to engage the Arameans.
When the Arameans realized that they had been defeated by Israel, they sent messengers to bring out the Arameans who were across the Euphrates with Shophach, commander of Hadadezer's army, leading them.
When this was reported to David, he gathered all Israel and crossed the Jordan. He came up to them and lined up in battle formation against them. When David lined up to engage the Arameans in battle, they fought against him.
But the Arameans fled before Israel, and David killed 7,000 of their charioteers and 40,000 foot soldiers. He also killed Shophach, commander of the army.
When Hadadezer's subjects saw that they had been defeated by Israel, they made peace with David and became his subjects. After this, the Arameans were never willing to help the Ammonites again.