Numbers 31:1

And the LORD spake unto Moses, saying,

The verse opens God's command to Moses to avenge Israel on the Midianites by making war against them. That command was judgment for Midian's guilt in leading Israel into sin at Peor. The Midianite women, acting on Balaam's counsel, drew Israel into idolatry and sexual sin, bringing a plague in which 24,000 Israelites died.

The Midianites were judged promptly because their temptation was a particularly dangerous attack by a people seeking to destroy Israel. So the war was both punishment for guilt and merciful protection giving Israel victory over its attackers. Moses himself was to carry out this command, and afterward he was to die and be gathered to his people.

In this war Israel was to act as God's instrument, not from malice or revenge but from zeal to carry out His command. The command shows that God's judgments uphold His authority and that as Creator and Ruler He may appoint people to execute them. He thus used Israel to punish wicked nations that persisted in rebellion and tried to lead Israel into idolatry.