"Therefore say: Behold, I give to him My covenant of peace" (Numbers 25:12). Just as he made peace between Me and the children of Israel, so that they were not destroyed by My zeal—for I am zealous against idolatry—therefore I cut a covenant with him, that he shall have peace from them all, so that they shall not be able to harm him.
Pinchas and the Covenant of Peace That Shields Him From All Harm
Midrash Aggadah, Numbers 25:12
לכן אמור הנני נותן לו את בריתי שלום. כמו ששם שלום ביני ובין בני ישראל שלא לכלותם בקנאתי שאני מקנא לע"ז, לכך אני כורת ברית עמו שיהא לו שלום מכולם שלא יוכלו להזיקו: