Then the LORD said to Joshua, “Hold out your battle lance toward Ai, for into your hand I will deliver the city.” So Joshua held out his battle lance toward Ai,
18. And the Lord said unto Joshua, etc This passage shows, that owing either to the strong fortifications of the city, or the valor of its inhabitants, or the trepidation of the Israelites, the victory was difficult, since God promises that he himself would take it by the lifting up of a spear.
We have here an account of the taking of Ai by stratagem. The stratagem here used, we are sure, was lawful and good; God himself appointed it, and we have no reason to think but that the like is lawful and good in other wars.
Commenting on Joshua 8:3-22
And the Lord said unto Joshua, stretch out the spear that is in thy hand towards Ai,.... On which was a flag, as Abarbinel and Ben Melech think; and which is not improbable, and served for a signal for the ambush to come out and seize the city, as both they and Jarchi observe, as well as a signal also to the army of Israel...