Hanun was the Ammonite King who rebuffed David. When Hanun picked a fight with David, he definitely bit off more than he could chew. Hanun’s father, Nahash, was king of the Ammonites, and apparently he had maintained good relations with David, who was king of Israel.
When Nahash died, his son Hanun became king, and David sent a delegation to express sympathy for the death of Hanun’s father. Hanun, however, chose to interpret David’s gesture as a spy mission— and he essentially threw down the gauntlet by humiliating David’s men and sending them back to him (2 Samuel 10).
David, of course, prepared for war. In the meantime, Hanun made preparations of his own by hiring mercenaries from three other countries to the north. But David’s commander, Joab, proved too capable for Hanun’s coalition, and the Ammonites were defeated.
Later the Ammonites and their allies regrouped, mustering even more men from other lands—but David and his men defeated them a second time. After that Hanun’s allies refused to help him.
The Ammonites were very distant relatives of the Israelites through Abraham’s nephew Lot, but they were also longtime enemies of Israel. They fought against the Israelites during the period of the judges, and they also attacked the town of Jabesh Gilead soon after Saul was anointed king of Israel.
Anyone with Ammonite blood— even up to ten generations back—was forbidden from entering the tabernacle area (Deuteronomy 23:3).