Numbers 31:8

And they slew the kings of Midian, beside the rest of them that were slain; namely, Evi, and Rekem, and Zur, and Hur, and Reba, five kings of Midian: Balaam also the son of Beor they slew with the sword.

In Israel's war against Midian, Israel slew with the sword the five kings of Midian — Evi, and Rekem, and Zur, and Hur, and Reba — beside the rest of them that were slain, and Balaam also the son of Beor they slew with the sword. The war was fought as the Lord commanded Moses in order to avenge Israel, with the Israelites acting as instruments of God. The victory and the killing of Midian's leaders was an act of divine judgment against Midian for deceitful schemes that enticed Israel into sin at Peor and sought Israel's destruction, and it served to protect Israel.

Balaam perished with the Midianites whose favor he had obtained, because for Balak's reward and promotion he sold Israel by counseling Midian to seduce Israel to transgress God's law through idolatry and fornication at Peor, causing trespass against the Lord and a plague that killed twenty-four thousand Israelites. His fate followed his choice to join the Midianites, his covetousness, persistent rebellion against God, and cherished sin that corrupted his character despite great light and special privileges, like Judas. Although he had a presentiment of death and wished to die the death of the righteous, it did not change his destiny because he did not choose to live righteously.

The verse shows that those who devised harm against God's people and helped lead them into sin were themselves brought under judgment. Israel acted not from malice or revenge but from zeal for God's glory, and God's righteous use of Israel as instruments of wrath to punish wicked nations that had filled up their iniquity by rebellion, idolatry, and seducing His people belongs to His right as Maker and Ruler and is not cruelty or injustice. The earlier defeat did not end Midian's hostility, since Midian later grew into a powerful people and oppressed Israel again, yet the victory over the five kings helped make the surrounding nations fear Israel before the crossing of the Jordan.