Some time later, King Nahash of the Ammonites died, and his son became king in his place.
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?"
So Hanun took David's emissaries, shaved them, cut their clothes in half at the hips, and sent them away.
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.
David heard about this and sent Joab and the entire army of warriors.
The Ammonites marched out and lined up in battle formation at the entrance of the city while the kings who had come were in the field by themselves.
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.
He placed the rest of the forces under the command of his brother Abishai, and they lined up in battle formation to engage the Ammonites.
"If the Arameans are too strong for me," Joab said, "then you'll be my help. However, if the Ammonites are too strong for you, I'll help you.
Be strong! We must prove ourselves strong for our people and for the cities of our God. May the Lord's will be done."
Joab and the people with him approached the Arameans for battle, and they fled before him.
When the Ammonites saw that the Arameans had fled, they likewise fled before Joab's brother Abishai and entered the city. Then Joab went to Jerusalem.
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.