Why did God command the Israelites to completely destroy the Midianites in Numbers 31:17?

This article has been translated into the following languages: