23 Only the king of Ai was taken alive and brought to Joshua. 24 When the Israelite army finished chasing and killing all the men of Ai in the open fields, they went back and finished off everyone inside. 25 So the entire population of Ai, including men and women, was wiped out that day-12,000 in all. 26 For Joshua kept holding out his spear until everyone who had lived in Ai was completely destroyed. 27 Only the livestock and the treasures of the town were not destroyed, for the Israelites kept these as plunder for themselves, as the Lord had commanded Joshua. 28 So Joshua burned the town of Ai, and it became a permanent mound of ruins, desolate to this very day. 29 Joshua impaled the king of Ai on a sharpened pole and left him there until evening. At sunset the Israelites took down the body, as Joshua commanded, and threw it in front of the town gate. They piled a great heap of stones over him that can still be seen today.

Matthew Henry's Commentary on Joshua 8:23-29

Commentary on Joshua 8:23-29

(Read Joshua 8:23-29)

God, the righteous Judge, had sentenced the Canaanites for their wickedness; the Israelites only executed his doom. None of their conduct can be drawn into an example for others. Especial reason no doubt there was for this severity to the king of Ai; it is likely he had been notoriously wicked and vile, and a blasphemer of the God of Israel.