The incident with Pinchas began in Parshat Balak and continued through Parshat Pinchas and into Parshat Mattot.
After the heroic act of Pinchas, a revenge war was made against Midyan for their part in causing so many Jewish men to sin. This led to a plague that ended with the death of 24,000 Jews.
Rabbi Soloveitchik teaches that the lesson to be learned from this entire episode is the importance of the family in Jewish life. The evil Bilaam and the Midianites realized that the way to weaken עם ישראל was to break apart that adhesive bond of the Jewish family. When there was infidelity and giving into lusts, the moral fabric of that bond was severed in a way that was difficult to repair.
We must realize that when we nurture this specialness of the Jewish home, we create a protection from the pollution that exists in the world.
A home based on the three pillars of Judaism; Shabbat, Kashrut, and Family Purity, brings a strong wall of protection. We must be strong and not let anything in that will compromise the sanctity of the Jewish Family.