He did this to teach warfare to generations of Israelites who had no experience in battle.