Ramban asks to why the din of kashering kelim is mentioned only after the war with Midyan and not earlier, after Bnei Yisrael waged war with Sichon and Og. Ramban answers (based on Chulin 17) that during the battles for kibush ha'aretz, such as the battles against Sichon and Og and the future battles of Yehoshua, there was a heter to eat trief, so there was no need to kasher. The war against Midyan, however, unlike those others wars, was not a war to take territory, of kibush. It was a war of nekama, to punish Midyan for the sin of causing Bn"Y to succumb to the temptation for znus. Therefore, it was only here that the halachos of kashering are mentioned. (see here, here, here)
Sefas Emes suggests that the din of kashering was taught here because it fits with the larger lesson Moshe weas trying to convey. The gemara explains why Moshe was angry when he saw the soldiers returning with booty:
יקצף משה – אמר להם, שמא חזרתם לקלקולכם הראשון, אמרו לו, לא נפקד ממנו איש, אמר להם, אם כן כפרה למה, אמרו לו, אם מידי עבירה יצאנו, מידי הרהור לא יצאנו
Even though not a single soldier died in battle, Moshe was not satisfied that something was not rotten, that the grabbing of spoils was not indicative of a rehash of sin. Even though there was no overt wrongDOING he could point to, Moshe was concerned lest the people be guilty of hirhurei aveira, wrong THINKING.
This is the lesson of giulei Midyan. Even though there is no visible trief in a pot, it still must be kashered becauase of invisible taam that remains latent within it. So too, taught Moshe, it's not enough to just look at surface actions -- one must dig deeper and examine the thoughts latent in one's heart.
I think we've covered this is previous years, and just want to add an additional point this year and try to connect this point with another idea and see how it works.
Hashem commanded Moshe:
נְקֹ֗ם נִקְמַת֙ בְּנֵ֣י יִשְׂרָאֵ֔ל מֵאֵ֖ת הַמִּדְיָנִ֑ים אַחַ֖ר תֵּאָסֵ֥ף אֶל־עַמֶּֽיךָ
Moshe's own death hinged on the completion of this war against Midyan. Despite knowing this, Moshe immediately jumped into action. Rashi comments:
אף על פי ששמע שמיתתו תלוייה בדבר, עשה בשמחה ולא איחר.
Simple pshat in Rashi: even though Moshe could have postponed his death indefinitely by pushing off this war, he didn't do so. He acted with the same zerizus and alacrity as with any other mitzvah (see Gur Aryeh, Mizrachi).
Asks the Sefas Emes (5650): what's the hava amina that Moshe could have kicked the can down the road and cheated death? נְקֹ֗ם נִקְמַת֙ בְּנֵ֣י יִשְׂרָאֵ֔ל מֵאֵ֖ת הַמִּדְיָנִ֑ים is a mitzvah! Once told by Hashem to avenge Bn"Y and wage war against Midyan, surely Moshe would not deliberately be mevateil a mitzvah and not act on it.
Sefas Emes answers (and I'm adding my own spin to his approach) that when going to war, when going to take revenge, there is a very important condition that has to be met before you unholster your guns, so to speak. Ramban in P' Lech Lecha asks why it is that the Mitzrim were punished for enslaving Bn"Y when Hashem had told Avraham that his children would be punished by being forced into servitude. The Egyptians were fulfilling the nevuah, the ratzon Hashem! Ramban explains that ain hachi nami, had they done so lishma, that excuse would work. However, the reality is that they enslaved Bn"Y for their own ends alone. Without the l'shem shamayim, it's not a kiyum of ratzon Hashem -- it's abuse and torture. The Chofetz Chaim similarly explains that when Shaul haMelech failed to kill Agag, the navi Shmuel accuses him, "VaTa'as ha'ra b'einei Hashem," of doing wrong. You would think that Shaul's sin was in NOT doing what he was supposed to -- killing every member of Amalek -- not what he actually did do. Yet, that's not what the navi tells us. The sin is "VaTa'as," what Shaul did, because once he allowed his own cheshbonos and thoughts of right and wrong to enter into the equation, he was following his own agenda, and not purely the ratzon Hashem. To wipe out a nation based on your own agenda is genocide, not a mitzvah. We also find by the cheit ha'eigel, before the Leviim took up arms Moshe told them, "Mi l'Hashem ei'lei," (32:26, see Netziv), as only those motivated l'shem shamayim had a right to participate. You see from these sources and more that even when there is a heter, even when there is a mitzvah to cause harm, it has to be done carefully for the right reasons.
The Shem m'Shmuel is medayek in Rashi at the beginning of Pinchas that talks about the way the other shevatim slandered Pinchas: הראיתם בן פוטי זה, בן שפיטם אבי אמו עגלים לעבודה זרה יהרוג נשיא שבט מישראל. Why does Rashi mention specifically that Yisro "FATTENED" cows for avodah zarah? Why not zero in more directly on the fact that he OFFERED cows to avodah zarah? Sm"S explains that whether a cow is fat of skinny makes no inherent difference to the offering; it's just a matter of appearances. The shevatim were accusing Pinchas of being someone superficial, someone lacking depth, someone for whom appearances matter more than anything else. When you pull out your sword to kill, there has to be more than that. You have to reflect on your own motives, you have to reflect on the motives of the other party if you are acting with kana'us on the assumption that they are completely in the wrong. You have to look at more than appearances. L'shem shamayim is something that comes from deep within, not something found on the surface. (see more here)
Coming back to our parsha, yes, Moshe was given a mitzvah of נְקֹ֗ם נִקְמַת֙ בְּנֵ֣י יִשְׂרָאֵ֔ל מֵאֵ֖ת הַמִּדְיָנִ֑ים, to avenge Bn"Y, but just like in these other cases where the use of violence necessitated 100% being motivated l'shem shamayim with no other agenda, here too, the mitzvah entailed being motivated 100% to avenge what was done to Bn"Y. It can't be 95 or 98 or 99% nekama -- it's 100% all in or it's stam violance and not a kiyum mitzvah. How can you be 100% all in for nekama when you know your own life is forfeit if you do so? No question Moshe would DO the mitzvah, would act if Hashem wanted him to act. But the mitzvah here required more than action -- it required Moshe's placing the motivation to avenge Bn"Y, to avenge kvod shamayim, beyond any consideration of his own life. He had to be all in, 100% on board and motivated. And that is the test that he passed.
Coming back to the mitzvah of kashering kelim and hirhurei aviera, that is why those ideas were so important davka now, davka in this battle against Midyan. When Moshe presented the mitzvah to Bn"Y, he reformulated it as "la'teit nikmat Hashem b'Midyan." Moshe had to put even consideration for his own life on the backburner in order to have the proper motivation to fulfill that mitzvah. Imagine what was going through his mind as he saw those soldiers coming back with the spoils of war. Is this how soldiers motivated by "nikmat Hashem" alone, with no regard for their own agenda, return from battle? Does a soldier motivated purely by "nikmat Hashem" stop to collect treasure along the way? אם מידי עבירה יצאנו, מידי הרהור לא יצאנו.