Then the Lord told Joshua, “Hold up the spear in your hand and point it at Ai, because I'm giving it to you.” So Joshua held up the spear in his hand and pointed it at the town.
You will do to Ai and its king what you did to Jericho and its king. However, this time you may keep for yourselves the plunder and the livestock. Set up an ambush behind the town.”
When the men of Ai looked back they saw the smoke rising up into the sky from the town. They had nowhere to run to, because the Israelites who had been running away towards the wilderness now turned on their pursuers.
The main army of Israelites left where they were and took up positions at Baal-tamar, while those in the ambush west of Gibeah charged out to attack from where they had been hiding.