Joshua 8:16-26

16So all the people who were in the city were called together to pursue them, and as they pursued Joshua they awere drawn away from the city. 17Not a man was left in Ai or Bethel who did not go out after Israel. They left the city open and pursued Israel.

18Then the Lord said to Joshua, b“Stretch out the javelin that is in your hand toward Ai, for I will give it into your hand.” And Joshua stretched out the javelin that was in his hand toward the city. 19And the men in the ambush rose quickly out of their place, and as soon as he had stretched out his hand, they ran and entered the city and captured it. And they hurried to set the city on fire. 20So when the men of Ai looked back, behold, the smoke of the city went up to heaven, and they had no power to flee this way or that, for the people who fled to the wilderness turned back against the pursuers. 21And when Joshua and all Israel saw that the ambush had captured the city, and that the smoke of the city went up, then they turned back and struck down the men of Ai. 22And the others came out from the city against them, so they were in the midst of Israel, some on this side, and some on that side. And Israel struck them down, until there was cleft none that survived or escaped. 23But the king of Ai they took alive, and brought him near to Joshua.

24When Israel had finished killing all the inhabitants of Ai in the open wilderness where they pursued them, and all of them to the very last had fallen by the edge of the sword, all Israel returned to Ai and struck it down with the edge of the sword. 25And all who fell that day, both men and women, were 12,000, all the people of Ai. 26But Joshua did not draw back his hand with which he dstretched out the javelin until he had devoted all the inhabitants of Ai to destruction.
That is, set apart ( devoted) as an offering to the Lord (for destruction)
Copyright information for ESV