The Lord said to Joshua, "Do not be afraid or discouraged. Take the whole military force with you and go attack Ai. Look, I have handed over to you the king of Ai, his people, city, and land.
Treat Ai and its king as you did Jericho and its king; you may plunder its spoil and livestock for yourselves. Set an ambush behind the city."
So Joshua and the whole military force set out to attack Ai. Joshua selected 30,000 fighting men and sent them out at night.
He commanded them: "Pay attention. Lie in ambush behind the city, not too far from it, and all of you be ready.
Then I and all the people who are with me will approach the city. When they come out against us as they did the first time, we will flee from them.
They will come after us until we have drawn them away from the city, for they will say, 'They are fleeing from us as before.' While we are fleeing from them,
you are to come out of your ambush and seize the city, for the Lord your God has handed it over to you.
After taking the city, set it on fire. Follow the Lord's command-see [that you do] as I have ordered you."
So Joshua sent them out, and they went to the ambush site and waited between Bethel and Ai, to the west of Ai. But he spent that night with the troops.
Joshua started early the next morning and mobilized them. Then he and the elders of Israel led the troops up to Ai.
All thosea who were with him went up and approached the city, arriving opposite Ai, and camped to the north of it, with a valley between them and the city.
Now Joshua had taken about 5,000 men and set them in ambush between Bethel and Ai, to the west of the city.
The military force was stationed in this way: the mainb camp to the north of the city and its rear guard to the west of the city. And that night Joshua went into the valley.
When the king of Ai saw [the Israelites], the men of the city hurried and went out early in the morning, so that he and all his people could engage Israel in battle at a suitable place facing the plainc [of the Jordan]. But he did not know there was an ambush [waiting] for him behind the city.
Joshua and all Israel pretended to be beaten back by them and fled toward the wilderness.
Then all the troops of Ai were summoned to pursue them, and they pursued Joshua and were drawn away from the city.
Not a man was left in Ai or Bethel who did not go out after Israel, leaving the city exposed while they pursued Israel.
Then the Lord said to Joshua, "Hold out the sword in your hand toward Ai, for I will hand the city over to you." So Joshua held out his sword toward it.
When he held out his hand, the men in ambush rose quickly from their position. They ran, entered the city, captured it, and immediately set it on fire.
The men of Ai turned and looked back, and smoke from the city was rising to the sky! They could not escape in any direction, and the troops who had fled to the wilderness now became the pursuers.
When Joshua and all Israel saw that the [men in] ambush had captured the city and that smoke was rising from it, they turned back and struck down the men of Ai.
The men in the ambush came out of the city against them, and the men of Ai were [trapped] between the Israelite forces, some on one side and some on the other. They struck them down until no survivor or fugitive remained,
but they captured the king of Ai alive and brought him to Joshua.
When Israel had finished killing everyone living in Ai who had pursued them into the open country, and when every last one of them had fallen by the sword, all Israel returned to Ai and struck it down with the sword.
The total of those who fell that day, both men and women, was 12,000-all the people of Ai.
Joshua did not draw back his hand that was holding the sword until all the inhabitants of Ai were completely destroyed.
Israel plundered only the cattle and spoil of that city for themselves, according to the Lord's command that He had given Joshua.
Joshua burned Ai and left it a permanent ruin, desolate to this day.
He hungd [the body of] the king of Ai on a treee until evening, and at sunset Joshua commanded that they take his body down from the tree.f They threw it down at the entrance of the city gate and put a large pile of rocks over it, which remains to this day.
At that time Joshua built an altar on Mount Ebal to the Lord, the God of Israel,
just as Moses the Lord's servant had commanded the Israelites. He built it according to what is written in the book of the law of Moses: an altar of uncut stones on which no iron tool has been used.g Then they offered burnt offerings to the Lord and sacrificed fellowship offerings on it.
There on the stones, Joshua copied the law of Moses, which he had written in the presence of the Israelites.
All Israel, foreigner and citizen alike, with their elders, officers, and judges, stood on either side of the ark of the Lord's covenant facing the Levitical priests who carried it. As Moses the Lord's servant had commanded earlier, half of them were in front of Mount Gerizim and half in front of Mount Ebal, to bless the people of Israel.h34
Afterwards, Joshua read aloud all the words of the law-the blessings as well as the curses-according to all that is written in the book of the law.
There was not a word of all that Moses had commanded that Joshua did not read before the entire assembly of Israel, including the women, little children, and foreigners who were with them.