One should always cleave to people of good character, as we see from Aaron, who married Aminadab’s daughter and had Phineas as his grandson (Bava Batra 109b). Phineas did not become a priest until he had slain Zimri. Rav Ashi says: Until he made peace among the Tribes of Reuben, Gad, Manasseh, and Israel (Zevachim 101b). Not for naught did Phineas go to war against the Midianites, but to exact retribution for his ancestor Joseph, of whom it is written: "The Midianites had sold him to Egypt" (Genesis 37:36) (Sotah 43a).
The narrative of Phineas, son of Eleazar, grandson of Aaron, surrounds the account of Balaam, Israel’s "anti-Prophet." It is more than a literary encirclement. The beleaguered Balaam is finally slain by the zealous priest of Israel in Numbers 31. But Phineas is more famous (infamous?) for his first act of "speardom" as he pierces an Israelite man and Midianite woman engaging in harlotry directly in front of the Tent of Assembly (Num.25:8). This immorality had been encouraged by Balaam who, frustrated by his inability to curse the people Israel, employs the Moabites and Midianites to entice Jewish men to debauchery. Until Phineas’s moral "thrust" the plot had been successful.
So successful that the "wrath of the Lord flared up against Israel" (Num.25:3). Translation: 24,000 Israelite lives were taken by a plague in retribution for the orgy of immorality with "forbidden" women. But Phineas’s heroism ended the devastation. His reward? First, an entire chapter of the chapter is named eponymously for him. Second, the Lord tells Moses: "Behold! I give him My covenant of peace. And it shall be for him and his offspring after him a covenant of eternal priesthood, because he took vengeance for his God, and he atoned for the Children of Israel" (Num.25:12-13).
Phineas now ascends from the level of Levite to Kohen, and his descendants will be High Priests. From warrior to religious leader, but as indicated above, he also returned to battle against the Midianites (who quite coincidentally had sold his ancestor, Joseph the Dreamer, into Egyptian bondage). The Midianites were summarily punished because of their principal responsibility for the Jewish sins of immorality and idolatry that resulted in the plague. Phineas is included in this military incursion because God wanted Israel to know that Phineas had rescued them from utter calamity and was thereby deserving of eternal reward.
Millenia later Phineas became the memorable character of John Knowles’s tome A Separate Peace. The Biblical character was a fighter for God’s righteousness; the hero of Knowles’s book was a wonderful, lilting, pacific, lamb-like figure. Both ultimately achieved peace, but in remarkably different ways.