Joshua 8:14
And it came to pass, when the king of Ai saw it, that they hasted and rose up early, and the men of the city went out against Israel to battle, he and all his people, at a time appointed, before the plain; but he wist not that there were liers in ambush against him behind the city.
The wider account follows Israel's march from Gilgal to overthrow Jericho and then to conquer Ai. This moment belongs to the renewed, second assault on Ai after Achan had been sentenced and punished and God's wrath had been turned away from Israel. For that renewed assault Joshua was commanded to muster all the men of war and go up against Ai again.
The king of Ai and all his people hastened and rose early to go out to battle against Israel, not knowing that Israel had set forces in ambush behind the city to draw them out. In this battle Israel advanced again in God's power, and the armies of heaven fought on Israel's behalf. The men of Ai were put to flight. The city itself was soon taken.
That conquest of Ai remains linked with Gilgal, the place where Israel would later gather under Samuel and Saul.