18 Then the Lord said to Joshua, “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. 19 And 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. 20 So 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. 21 And 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. 22 And 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 left none that survived or escaped. 23 But the king of Ai they took alive, and brought him near to Joshua.
24 When 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. 25 And all who fell that day, both men and women, were 12,000, all the people of Ai. 26 But Joshua did not draw back his hand with which he stretched out the javelin until he had devoted all the inhabitants of Ai to destruction.  27 Only the livestock and the spoil of that city Israel took as their plunder, according to the word of the Lord that he commanded Joshua. 28 So Joshua burned Ai and made it forever a heap of ruins, as it is to this day. 29 And he hanged the king of Ai on a tree until evening. And at sunset Joshua commanded, and they took his body down from the tree and threw it at the entrance of the gate of the city and raised over it a great heap of stones, which stands there to this day.
30 At that time Joshua built an altar to the Lord, the God of Israel, on Mount Ebal, 31 just as Moses the servant of the Lord had commanded the people of Israel, as it is written in the Book of the Law of Moses, “an altar of uncut stones, upon which no man has wielded an iron tool.” And they offered on it burnt offerings to the Lord and sacrificed peace offerings. 32 And there, in the presence of the people of Israel, he wrote on the stones a copy of the law of Moses, which he had written. 33 And all Israel, sojourner as well as native born, with their elders and officers and their judges, stood on opposite sides of the ark before the Levitical priests who carried the ark of the covenant of the Lord, half of them in front of Mount Gerizim and half of them in front of Mount Ebal, just as Moses the servant of the Lord had commanded at the first, to bless the people of Israel. 34 And afterward he read all the words of the law, the blessing and the curse, according to all that is written in the Book of the Law. 35 There was not a word of all that Moses commanded that Joshua did not read before all the assembly of Israel, and the women, and the little ones, and the sojourners who lived  among them. (ESV)