In the book of Joshua, chapter 8, God gives instructions on how to win the battle for Ai. Joshua sends soldiers to hide behind the city. Then he and his army attack from the front. When the men of Ai come out to fight, Joshua pretends to be losing the battle, and leads them away from their city. The soldiers who are hiding come out and set the city on fire. Now the army of Ai is stuck! There is an army behind them, and Joshua's army in front of them turns around to fight after all! There is nowhere for them to go.