According to the Zohar. Pinchas “saw”
in a prophetic vision
the letters mem מ and tav ת descending ominously from Above
to threaten the Israelites with מת death because of their debauchery. He prevented this with his רומח spear
capturing and neutralizing the mem מ within the letters
raish ר and chet ח thus creating ruach רוח soul.
Given this mystical context, we can understand and even exonerate what would otherwise be a grisly “directed assassination” by an uncouth Zealot and certainly not an action that would be condoned by the Rabbis in a Bait Din.
G-d rewards Pinchas by “upgrading” him and his descendants to be Kohanim and establishing with him “a Covenant of Peace” הִנְנִי נֹתֵן לוֹ אֶת-בְּרִיתִי שָׁלוֹם (Numbers 25: 12)
However the word Shalom שלום is written with a deliberately broken vav ו (which if it would appear anywhere else would disqualify the Torah from being used) perhaps to indicate G-d’s regret over the use of force.