Rashi
Jewish
1040–1105
“Only so that they should know. For this alone, He permitted these nations to remain, so that future generations of the Bnei Yisroel might grasp the consequence of iniquity—for it was now necessary for them to undergo martial training. Whereas earlier when they stood worshiping Adonoy. This was unknown. These wars and the art of battle. It was unnecessary.”