Some time later, the Ammonite King Nahash died, and his son succeeded him as king.
References for 1 Chronicles 19:1
"I'll be loyal to Nahash's son Hanun," David said, "because his father was loyal to me." So David sent messengers with condolences about his father's death. But when David's servants arrived in the Ammonite territory to express his sympathy to Hanun,
the Ammonite leaders asked Hanun, "Do you really believe David is honoring your father because he has sent you condolences? Of course not! His servants have come to search the city, spy it out, and overthrow it!"
So Hanun took David's servants, shaved them, cut off half their garments from their buttocks down, and sent them off.
When this was reported to David, he sent messengers to the men because they were completely ashamed. The king said, "Stay in Jericho until your beards have grown. Then you can come back."
When the Ammonites realized that they had offended David, Hanun and the Ammonites sent one thousand kikkars of silver to hire chariots and cavalry for themselves from Aram-naharaim, Aram-maacah, and Zobah.
They hired thirty-two thousand chariots, as well as King Maacah and his army, who came and camped in front of Medeba, while the Ammonites left their cities and came together ready for battle.
When David heard this, he sent Joab and the entire army of warriors.
The Ammonites marched out and formed a battle line at the entrance to the city, while the kings who had come remained in the countryside.
When Joab saw that the battle would be fought on two fronts, he chose some of Israel's finest warriors and deployed them to meet the Arameans.
The rest of the army Joab placed under the command of his brother Abishai. When they took up their positions to meet the Arameans,
Joab said, "If the Arameans prove too strong for me, you must help me, and if the Ammonites prove too strong for you, I'll help you.
Be brave! We must be courageous for the sake of our people and the cities of our God. The LORD will do what is good in his eyes."
When Joab and the troops who were with him advanced into battle against the Arameans, they fled from him.
When the Ammonites saw that the Arameans had fled, they also fled from his brother Abishai and retreated into the city. So Joab returned to Jerusalem.
The Arameans saw that they had been defeated by Israel. They sent out messengers to bring Aramean reinforcements from the other side of the river, with Shophach the commander of Hadadezer's army at their head.
Upon hearing this, David gathered all Israel and crossed the Jordan. David advanced and took up positions against the Arameans to meet them in battle. After initiating the battle,
the Arameans fled before Israel, and David killed seven thousand Aramean chariot drivers and forty thousand foot soldiers. Shophach the commander of their army was killed too.
When the servants of Hadadezer saw that they had been defeated by Israel, they made peace with David and served him. Never again would the Arameans come to the aid of the Ammonites.