1The LORD said to Joshua, "Do not fear and do not be dismayed. Take with you all the people of battle and arise; go up to Ai. See, I have given into your hand the king of Ai and his people and his city and his land.2You shall do to Ai and to its king just as you did to Jericho and to its king, except its spoil and its livestock you may plunder for yourselves. Set an ambush for the city behind it."3So Joshua arose, and all the people of battle with him, to go up to Ai. Joshua chose thirty thousand mighty men of valor and sent them out by night.4He commanded them, saying, "See that you lie in ambush against the city behind the city. Do not go far from the city, but all of you be ready.5I and all the people who are with me will approach the city. It shall be that when they come out to meet us as at the first, then we will flee before them.6They will come out after us until we have drawn them away from the city, for they will say, 'They are fleeing before us as at the first.' Then we will flee before them.7You shall arise from the ambush and seize the city, and the LORD your God will give it into your hand.8It shall be that when you have seized the city, you shall set the city on fire according to the word of the LORD. See to it; I have commanded you."9Joshua sent them out, and they went to the place of ambush and stayed between Bethel and Ai, west of Ai. Joshua spent that night in the midst of the people.10Joshua rose early in the morning and mustered the people. He and the elders of Israel went up before the people to Ai.11All the people of battle who were with him went up and drew near and came before the city and camped north of Ai, with the valley between them and Ai.12He took about five thousand men and set them as an ambush between Bethel and Ai, west of the city.13The people set the whole camp north of the city and its rear guard west of the city. Joshua spent that night in the midst of the valley.14When the king of Ai saw this, he and all his people hurried and rose early and went out to meet Israel in battle at the appointed place before the Arabah, but he did not know that an ambush had been set for him behind the city.15Joshua and all Israel pretended to be beaten before them and fled by the way of the wilderness.16Then all the people who were in Ai were called out to pursue them, and they pursued Joshua and were drawn away from the city.17Not a man remained in Ai or Bethel who did not go out after Israel. They left the city open and pursued after Israel.18The LORD said to Joshua, "Stretch out the javelin that is in your hand toward Ai, for I will give it into your hand." So Joshua stretched out the javelin that was in his hand toward the city.19The ambush rose quickly from its place and ran as soon as he stretched out his hand, and they entered the city and captured it and quickly set the city on fire.20When the men of Ai turned back and looked, behold, the smoke of the city was rising to heaven, and they had no hands to flee this way or that. The people who had been fleeing to the wilderness turned against the pursuer.21Joshua and all Israel saw that the ambush had captured the city and that the smoke of the city was rising, so they turned back and struck the men of Ai.22The men who had come out of the city to meet them were in the midst of Israel, some on this side and some on that side, and they struck them down until no survivor or fugitive remained.23They captured the king of Ai alive and brought him to Joshua.24When Israel had finished killing all the inhabitants of Ai in the open field and in the wilderness where they had pursued them, and they had all fallen by the edge of the sword until they were finished, then all Israel returned to Ai and struck it with the edge of the sword.25The total of those who fell that day, both men and women, was twelve thousand—all the people of Ai.26Joshua did not draw back his hand with which he stretched out the javelin until he had devoted all the inhabitants of Ai to destruction.27Only the livestock and the spoil of that city Israel took as plunder for themselves, according to the word of the LORD that he had commanded Joshua.28Joshua burned Ai and made it a heap forever, a desolation, as it is to this day.29He hanged the king of Ai on a tree until evening. At the going down of the sun Joshua commanded, and they took his carcass down from the tree and threw it down at the entrance of the gate of the city and raised over it a great heap of stones, which remains to this day.