The entire force that was with him marched up and approached the city and arrived in front of it. They set up camp north of Ai, with the valley between them and the city.
Joshua had taken about five thousand men and set them in ambush between Bethel and Ai, to the west of the city.
They had the soldiers take up their positions--all those in the camp to the north of the city and the ambush to the west of it. That night Joshua went into the valley.
When the king of Ai saw this, he and all the men of the city hurried out early in the morning to meet Israel in battle at a certain place overlooking the Arabah.1 But he did not know2 that an ambush had been set against him behind the city.
References for Joshua 8:14