23 and the king of Ai they caught alive, and bring him near unto Joshua. 24 And it cometh to pass, at Israel's finishing to slay all the inhabitants of Ai in the field, in the wilderness in which they pursued them (and they fall all of them by the mouth of the sword till their consumption), that all Israel turn back to Ai, and smite it by the mouth of the sword; 25 and all who fall during the day, of men and of women, are twelve thousand—all men of Ai. 26 And Joshua hath not brought back his hand which he stretched out with the javelin till that he hath devoted all the inhabitants of Ai; 27 only, the cattle and the spoil of that city have Israel spoiled for themselves, according to the word of Jehovah which He commanded Joshua. 28 And Joshua burneth Ai, and maketh it a heap age-during—a desolation unto this day; 29 and the king of Ai he hath hanged on the tree till even-time, and at the going in of the sun hath Joshua commanded, and they take down his carcase from the tree, and cast it unto the opening of the gate of the city, and raise over it a great heap of stones till this day.

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.