Joshua 8:3

So Joshua arose, and all the people of war, to go up against Ai: and Joshua chose out thirty thousand mighty men of valour, and sent them away by night.

The verse belongs to Israel's march from Gilgal to conquer and overthrow Ai, with Gilgal as the place from which they set out for that conquest. That march came after the miraculous passage into the promised land.

The verse describes the second advance against Ai after Achan's sentence and execution. His execution had turned away God's wrath from Israel. Joshua mustered and marshaled all the fighting men of war and advanced against Ai again. He went up against Ai by divine command.

God's power accompanied Israel and heaven's armies fought for them, so their enemies were put to flight. With that divine power with them they soon took the city.