Pinehas, the son of Elazar the high priest, was among those who saw Zimri's shameless conduct. In his zeal to defend the honor of the Torah, he took a spear and entered Zimri's tent. Finding the ignoble prince in the company of the daughter of a Midianite prince, he killed them both with one thrust of his spear.
By this brave act, Pinehas stopped the plague which had begun among the children of Israel, and which had taken a toll of many thousands of dead among those who had allowed themselves to be seduced by the Midianites.
Pinehas' action was rewarded by a Divine covenant of peace and everlasting priesthood.
Following the outrageous attempt by the Midianites to seduce the children of Israel into sin, G-d ordered Moses to declare war against the Midianites and smite them. In the ensuing battle not only did the five princes of Midian f all with their vanquished troops, but also Balaam, the instigator of all this trouble, was slain.