Joshua 8:2

8:2 Do to Ai and its king what you did to Jericho and its king, except you may plunder its goods and cattle. Set an ambush behind the city!”

Joshua 8:22-29

8:22 At the same time the men who had taken the city came out to fight, and the men of Ai were trapped in the middle. The Israelites struck them down, leaving no survivors or refugees. 8:23 But they captured the king of Ai alive and brought him to Joshua.

8:24 When Israel had finished killing all the men of Ai who had chased them toward the desert (they all fell by the sword), all Israel returned to Ai and put the sword to it. 8:25 Twelve thousand men and women died that day, including all the men of Ai. 8:26 Joshua kept holding out his curved sword until Israel had annihilated all who lived in Ai. 8:27 But Israel did plunder the cattle and the goods of the city, in accordance with the Lord’s orders to Joshua. 8:28 Joshua burned Ai and made it a permanently uninhabited mound (it remains that way to this very day). 8:29 He hung the king of Ai on a tree, leaving him exposed until evening. At sunset Joshua ordered that his corpse be taken down from the tree. They threw it down at the entrance of the city gate and erected over it a large pile of stones (it remains to this very day).