1The LORD told Joshua, “Do not be afraid or lose heart. Take the entire fighting force with you and go up to Ai. See, I have handed over to you the king of Ai, his people, his city, and his land. 2Do to Ai and its king as you did to Jericho and its king. But you may take its spoils and its livestock for yourselves. Set an ambush behind the city.”
3So Joshua and the entire fighting force got ready to go up to Ai. Joshua chose thirty thousand able warriors and sent them out by night. 4He commanded them, “You are to lie in ambush behind the city. Don’t go very far from the city, and all of you be ready. 5I and all the people with me will approach the city. When they come out to meet us as they did the first time, we will flee before them. 6They will come after us until we draw them away from the city, for they will say, ‘They are fleeing before us as they did the first time.’ So we will flee before them. 7Then you will rise from the ambush and take possession of the city. The LORD your God will hand it over to you. 8When you seize the city, set it on fire. Do what the LORD has said. See, I have given you your orders.”
9Joshua sent them, and they went to the place of ambush. They stayed between Bethel and Ai, west of Ai. But Joshua spent that night among the people. 10Joshua got up early in the morning and mustered the people. He and the elders of Israel went up to Ai ahead of the people. 11All the fighting men with him went up and came right up in front of the city. They camped north of Ai, with a ravine between him and Ai. 12He took about five thousand men and set them in ambush between Bethel and Ai, west of the city. 13The people positioned the entire camp north of the city and its rear force west of the city. That night Joshua went into the valley.
14When the king of Ai saw this, the men of the city got up early and hurried out to meet Israel in battle, the king and all his people, at the appointed time, facing the Arabah. But he did not know there was an ambush behind the city. 15Joshua and all Israel gave way before them as though struck down and fled toward the wilderness. 16All the men in Ai were called out to chase them. They pursued Joshua and were drawn away from the city. 17Not a man was left in Ai or Bethel who did not go out after Israel. They left the city open and chased after Israel.
18The LORD told Joshua, “Stretch out the javelin in your hand toward Ai, for I will hand it over to you.” So Joshua stretched out the javelin in his hand toward the city. 19As soon as he stretched out his hand, the men in ambush rose quickly from their place and ran. They entered the city, captured it, and quickly set it on fire. 20The men of Ai turned and saw the smoke of the city rising to the sky. They had no way to flee in any direction, and the people fleeing toward the wilderness turned on their pursuers. 21When Joshua and all Israel saw that the ambush had taken the city and that smoke was rising from it, they turned back and struck the men of Ai. 22The others came out of the city against the men of Ai, who found themselves between the two forces of Israel, some on one side and some on the other. Israel struck them down, leaving no survivor or fugitive.
23But they took the king of Ai alive and brought him to Joshua. 24Israel finished killing all the inhabitants of Ai in the open country, in the wilderness where they had chased Israel. When all of them had fallen by the sword, all Israel turned back to Ai and struck it with the sword. 25All who fell that day, men and women, were twelve thousand, the entire population of Ai. 26Joshua did not draw back the hand he had stretched out with the javelin until he had devoted every inhabitant of Ai to destruction. 27Israel took only the livestock and the spoils of the city for themselves, in keeping with the word the LORD had given Joshua.
28Joshua burned Ai and made it a permanent mound of ruins, a desolate place to this day. 29He hung the king of Ai on a tree until evening. At sunset Joshua gave the order, and they took the corpse down from the tree and threw it at the entrance of the city gate. They raised a great heap of stones over him that remains to this day.
30Then Joshua built an altar to the LORD, the God of Israel, on Mount Ebal, 31just as Moses the servant of the LORD had commanded the Israelites, as written in the book of the law of Moses: an altar of whole stones that no one had worked with iron. On it they offered burnt offerings to the LORD and sacrificed fellowship offerings. 32There on the stones Joshua wrote a copy of the law of Moses, in the presence of the Israelites. 33All Israel, with its elders, officers, and judges, stood on either side of the ark, facing the Levitical priests carrying the ark of the covenant of the LORD. Resident foreigner and native alike stood there, half facing Mount Gerizim and half facing Mount Ebal, as Moses the servant of the LORD had formerly commanded for the blessing of the people of Israel.
34Afterward Joshua read all the words of the law, the blessing and the curse, in keeping with everything written in the book of the law. 35There was not one word of all that Moses commanded that Joshua did not read before the whole assembly of Israel, including the women, the children, and the resident foreigners who went with them.