Joshua 8:12
And he took about five thousand men, and set them to lie in ambush between Beth-el and Ai, on the west side of the city. And he took about five thousand men, and set them to lie in ambush between Beth-el and Ai, on the west side of the city.
Joshua 8:12 belongs to Israel's renewed second attack on Ai after the execution of the divine sentence upon Achan had turned away the wrath of God from Israel. That renewed attack followed the march from Gilgal after the overthrow of Jericho, and Gilgal remained associated with the march to conquer Ai. In obedience to God's command to marshal all the men of war and go up again against Ai, Joshua led the army and set the ambush.
The verse places the ambush on the west side of Ai, between the city and Bethel. The armies of heaven fought for Israel, the enemies were put to flight, and Israel soon took the city. The victory shows that obedience to God was Israel's only hope, and it began a renewed advance in which the Lord wrought mightily for His people as they pressed forward gaining fresh courage with every victory until the whole land was taken and every good thing promised to Israel came to pass.