In Deuteronomy 28:7, Moses tells the people of Israel that if they are obedient to the terms of the Mosaic covenant, they can expect their enemies to flee before them. They can expect to completely destroy their enemies because the Lord will fight on their behalf (see also Deuteronomy 20:4). The complete destruction of the armies of Ai therefore testifies that the Lord is fighting on behalf of Israel and he is giving them the blessings which he promised in the Mosaic covenant through the words of Moses (Deuteronomy 28:7).
21 And when Joshua and all Israel saw that the ambush had captured the city, and that the smoke of the city went up, then they turned back and struck down the men of Ai.