GOD said to Joshua, "Don't be timid and don't so much as hesitate. Take all your soldiers with you and go back to Ai. I have turned the king of Ai over to you--his people, his city, and his land.
"Do to Ai and its king what you did to Jericho and its king. Only this time you may plunder its stuff and cattle to your heart's content. Set an ambush behind the city."
The whole army, fighting men all, marched right up within sight of the city and set camp on the north side of Ai. There was a valley between them and Ai.
So it happened that when the king of Ai saw all this, the men of the city lost no time; they were out of there at the crack of dawn to join Israel in battle, the king and his troops, at a field en route to the Arabah. The king didn't know of the ambush set against him behind the city.
There wasn't a soul left in Ai or Bethel who wasn't out there chasing after Israel. The city was left empty and undefended as they were chasing Israel down.
Then GOD spoke to Joshua: "Stretch out the javelin in your hand toward Ai--I'm giving it to you." Joshua stretched out the javelin in his hand toward Ai.
The army on the run toward the wilderness did an about-face--Joshua and all Israel, seeing that the ambush had taken the city, saw it going up in smoke, turned and attacked the men of Ai.
Then the men in the ambush poured out of the city. The men of Ai were caught in the middle with Israelites on both sides--a real massacre. And not a single survivor.
When it was all over, Israel had killed everyone in Ai, whether in the fields or in the wilderness where they had chased them. When the killing was complete, the Israelites returned to Ai and completed the devastation.
He hanged the king of Ai from a tree. At evening, with the sun going down, Joshua ordered the corpse cut down. They dumped it at the entrance to the city and piled it high with stones--you can go see that also.
He built it following the instructions of Moses the servant of GOD to the People of Israel and written in the Book of The Revelation of Moses, an altar of whole stones that hadn't been chiseled or shaped by an iron tool. On it they offered to GOD Whole-Burnt-Offerings and sacrificed Peace-Offerings.
All Israel was there, foreigners and citizens alike, with their elders, officers, and judges, standing on opposite sides of the Chest, facing the Levitical priests who carry GOD's Covenant Chest. Half of the people stood with their backs to Mount Gerizim and half with their backs to Mount Ebal to bless the People of Israel, just as Moses the servant of GOD had instructed earlier.
There wasn't a word of all that Moses commanded that Joshua didn't read to the entire congregation--men, women, children, and foreigners who had been with them on the journey.