10Joshua rose early in the morning, mustered the people, and he and the elders of Israel went up before the people to Ai.
11All the fighting men who were with him went up and approached the city. They camped to the north of Ai, with the valley between them and the city.
12He took about five thousand men and set them in ambush between Bethel and Ai, west of the city.
13The people positioned all the camp to the north of the city, while a rear guard was placed to the west of the city. That night, Joshua went into the valley.
14When the king of Ai saw this, he and all his men of the city hurried and rose early, going out to meet Israel in battle at the appointed place near the Arabah. But he did not know that an ambush was set against him behind the city.
15Joshua and all Israel pretended to be beaten before them and fled toward the wilderness.
16All the people of Ai were summoned to pursue them. They chased after 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 unguarded and pursued Israel.
18The Lord said to Joshua, "Stretch out the javelin in your hand toward Ai, for I will give it into your hand." So Joshua stretched out the javelin in his hand toward the city.
19As soon as he stretched out his hand, the ambush rose quickly from their position, ran into the city, captured it, and immediately set it on fire.
20When the men of Ai looked back, they saw the smoke of the city rising to the sky, and they had no power to flee in any direction. The Israelites who had fled toward the wilderness now turned against their pursuers.
21When Joshua and all Israel saw that the ambush had captured the city and that its smoke was rising, they turned back and struck down the men of Ai.
22The others came out from the city to meet them, so the men of Ai were surrounded by the Israelites, some on one side and some on the other. They struck them down until no survivors or fugitives were left.
23But they captured the king of Ai alive and brought him to Joshua.