1 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. 2 "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."
3 Joshua and all his soldiers got ready to march on Ai. Joshua chose thirty thousand men, tough, seasoned fighters, and sent them off at night with these orders: "Look sharp now. Lie in ambush behind the city. Get as close as you can. Stay alert. I and the troops with me will approach the city head-on. When they come out to meet us just as before, we'll turn and run. They'll come after us, leaving the city. As we are off and running, they'll say, 'They're running away just like the first time.' That's your signal to spring from your ambush and take the city. God, your God, will hand it to you on a platter. Once you have the city, burn it down. God says it, you do it. Go to it. I've given you your orders." 9 Joshua sent them off. They set their ambush and waited between Bethel and Ai, just west of Ai. Joshua spent the night with the people.
10 Joshua was up early in the morning and mustered his army. He and the leaders of Israel led the troops to Ai. 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. He had taken about five thousand men and put them in ambush between Bethel and Ai, west of the city. They were all deployed, the main army to the north of the city and the ambush to the west. Joshua spent the night in the valley. 14 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. 15 Joshua and all Israel let themselves be chased; they ran toward the wilderness. Everybody in the city was called to the chase. They pursued Joshua and were led away from 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.
18 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. At the signal the men in ambush sprang to their feet, ran to the city, took it, and quickly had it up in flames. 20 The men of Ai looked back and, oh! saw the city going up in smoke. They found themselves trapped with nowhere to run. 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. 22 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. Except for the king of Ai; they took him alive and brought him to Joshua.
24 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. The death toll that day came to twelve thousand men and women - everyone in Ai. 26 Joshua didn't lower his outstretched javelin until the sacred destruction of Ai and all its people was completed. Israel did get to take the livestock and loot left in the city; God's instructions to Joshua allowed for that. 28 Joshua burned Ai to the ground. A "heap" of nothing forever, a "no-place" - go see for yourself. 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.