Therefore the children of Israel could not stand before their enemies, but turned their backs before their enemies, because they were accursed: neither will I be with you any more, unless you destroy the accursed from among you.
Read Chapter 7
Augustine of Hippo
AD 430
For we find that some sins are also a punishment for other sins … as in the flight of the Israelites from the face of the enemy out of the city of Ai because fear was instilled into their hearts so that they fled. And this was done to punish their sin and to punish it as it deserved to be punished, which is why the Lord said to Joshua, the son of Nun, “The children of Israel shall not be able to stand before their enemies.” What is the meaning of “shall not be able to stand”? Why did they not use their free will to stand rather than take flight because their wills were thrown into confusion by fear? Was it not for the simple reason that God, as Master of people’s wills, can in his anger instill fear into the hearts of whomsoever he pleases? Was it not of their own free choice that the enemies of the Israelites fought against God’s own people when they had Joshua, son of Nun, as their leader? And yet the Scripture tells us that “it was by the will of the Lord that their hearts should be strengthened that they should fight against Israel … and should be destroyed.” - "On Grace and Free Will 20.41"