After Israel's defeat because of Achan's sin, the Lord spoke to Joshua, saying, "Do not be afraid or discouraged. Take the whole army and go against Ai, for I have given you its king, its people, and its land. Do to Ai as you did to Jericho, but this time you may take the plunder and livestock for yourselves. Set an ambush behind the city."
Joshua chose thirty thousand of his best warriors and sent them out by night, commanding them to lie in ambush behind Ai. "When the men of Ai come out to fight, we will flee as before," Joshua said. "Then, when they have left the city, you will rise up, capture it, and set it on fire."
At dawn, Joshua and the leaders marched toward Ai. Five thousand more men were placed in ambush between Bethel and Ai. When the king of Ai saw them, he and his men hurried out to attack, not knowing an ambush waited behind. Joshua and his men pretended to retreat, drawing all the warriors of Ai away from the city until it was left unguarded.
Then the Lord said, "Stretch out the javelin in your hand toward Ai, for I have delivered it into your hand." Joshua held out his javelin, and at that signal, the ambush rose quickly, entered the city, and set it on fire. The men of Ai looked back and saw smoke rising into the sky, and they were trapped—Israel attacked from both front and rear.
Every man and woman of Ai, twelve thousand in all, were struck down that day. Joshua kept his javelin extended until every enemy was destroyed, just as the Lord commanded. Israel took the livestock and plunder for themselves and burned Ai, making it a permanent ruin. The king of Ai was hanged on a tree until evening, and his body was later buried under a great pile of stones near the city gate.
Afterward, Joshua built an altar to the Lord on Mount Ebal, just as Moses had commanded. The altar was made of uncut stones, untouched by iron tools. Burnt and fellowship offerings were presented to the Lord. Joshua then copied the Law of Moses on stones and read aloud all the words—the blessings and the curses—to the entire assembly of Israel, including the women, children, and foreigners among them.
Thus, Israel was restored in obedience, and the covenant with the Lord was renewed.
