He did this only in order to teach each generation of Israelites about war, especially those who had never been in battle before.