Simeon and Levi avenged Dinah, which constituted avenging Israel. Whoever says that their deed against Shechem was a sin, is mistaken, for G-d commanded (Num. 2:2), “The children of Israel shall camp with each person near the banner having his paternal family's insignia,” and our sages comment (Bamidbar Rabbah 2:7):
Every prince had an insignia. Each had a banner bearing the color of a precious gem on Aharon's heart...The prince of every tribe had a banner of the same color as his precious gem... Simeon's gem was emerald and his banner was green, bearing a picture of [the city of] Shechem.
If Simeon's deed in Shechem were a sin, how could G-d command that it be publicized on his banner? Moreover, Maharzo explains the Midrash: “Shechem: For their valor and self-sacrifice at Shechem. Although Levi was with him, Simeon was older and the main character. This is his praise for having zealously dealt with sexual sin.”...What occurred at Shechem surely did not constitute sin but self-sacrifice in pursuit of revenge in the right time and place. Whoever examines Scripture well will see that Jacob did not reprimand Simeon and Levi as if the deed were unethical. He only feared the outcome, the danger that might result (Gen. 34:40) “You have gotten me in trouble, giving me a bad reputation among the Canaanites and Perizites who live in the land. I have only a small number of men. They can band together and attack me and my family and I will be wiped out.” By their response, “Shall he treat our sister like a harlot?” (Gen. 34.31) they meant:”Surely no sin was committed here. We have avenged our sister, the victim of a heinous crime. As for your fear of the nations, to avoid profanation of G-d's name one must surely sacrifice one's life.” R. Yehuda bar Simon said (Bereshit Rabbah 80:12): [They said]:The water was muddy and we made it clear.
...If so, however, the question arises why Jacob cursed them (Gen. 49:5-7, current Parasha, see above). The answer is this: Certainly, after Simeon and Levi gave Jacob their answer - “Shall he treat our sister like a harlot?” - he silently accepted their argument, for all the aforesaid reasons. And there was certainly no sin in their killing the people of Shechem. Quite the contrary, they were fulfilling a great mitzvah of revenge and self-sacrifice. It was for this reason that G-d engraved for all time the image of the city of Shechem on Simeon's banner. Later, however, Simeon and Levi tried to scheme against Joseph and even thought to kill him. As our sages say (Lekach Tov on Gen. 49:23): “People made his life bitter and attacked him”: These are his brothers. “Masters of strife made him their target”: These are Simeon and Levi, as it says, “They are plotting to kill him” (Gen. 37:18).
We also find (Tanchuma Yashan, VaYeshev 13), “They said to each other, 'Here comes the dreamer! Let us kill him!' (Gen. 37:19): Who spoke to each other? Simeon and Levi.” Bereshit Rabbah (84:16) teaches: “'They took him and threw him into the pit' (Gen. 37:24). The written form is vayikachayhu, meaning 'he took him'. Who was this? Simeon. When was he punished? Later on when it says (Gen. 42:24), '[Joseph] took Simeon from them.'” Ultimately, it was Simeon and Levi who made Joseph's sale a fact. As our sages said (Midrash HaGadol on Gen. 49:5), “'Instruments of crime are their wares': This refers to the sale of Joseph.” When Jacob heard all this, he was shocked, and he understood that although their deed at Shechem was an act of revenge, a mitzvah and a duty, they were motivated by wicked anger. Anger is so unseemly that our sages said (Nedarim 22a-22b): “Whoever becomes angry, falls prey to all sorts of Hellish forces...Even the Divine presence becomes unimportant to him...It even makes him forget his Torah learning and makes him foolish.”Jacob now understood that Simeon's and Levi's deeds stemmed from anger. True, at Shechem they performed a good deed, yet motivated by anger, they ultimately went so far as to try to kill a saint like Joseph.
...To conclude, Jacob did not, G-d forbid, curse Simeon and Levi, but their rage, the evil cause of their sin. ...Zealotry and vengefulness are crucial attributes, but only if exercised for the sake of Heaven, as done by Pinchas, Elijah and others like them. ...Certainly, revenge, violence and murder are all grave acts, and when perpetrated solely for the sake of a king's or a nation's glory, or for personal revenge, they constitute an odious sin. Yet, whoever follows G-d's orders and duly clings to His mitzvot and values, applying mercy, kindness and peace in the right time and place, and cruelty, revenge and war in the right time and place, is serving G-d.
Revenge is rooted in Israel and in their great leaders. We find this with Samson. After he “smote them hip and thigh with a great slaughter” (Jud. 15:8), the base men of Yehuda came to hand him over to the Philistines, claiming fearfully (Jud. 15:11), “ Are you unaware that the Philistines are rulers over us? What have you done to us?" Samson replied (Ibid.), “As they did to me, so did I to them”. Samson was crowned with the title of tzaddik, “righteous one”. ...So great was he that Jacob thought Samson would be the Messiah (Bereshit Rabbah 98:14):”Jacob saw Samson and thought he was the Messiah. After he died, Jacob said, 'This one is dead too! I waited for your salvation, Oh L-rd!' (Gen. 49:18)
Rabbi Meir Kahane's son Rav Binyamin Ze'ev explains this in The writings of Rav Binyamin Ze'ev Kahane, HY”D: When Jacob blesses Dan, the sages tell us that through “Ruach HaKodesh”, Jacob saw Samson wreaking havoc upon the Philistines, and thought that he was the Messiah. Only after seeing Samson die did a disappointed Jacob realize that Samson was not the Messiah, and thus he uttered the words in our Parasha, “I waited for your salvation, Oh L-rd”.
There is no more disgraceful or wicked trait than cruelty at the wrong time and place. Possessing this trait can even lead to one's Jewishness being suspect, as in the ruling of Shulchan Aruch, Even Ha-Ezer, Piriah Ve-riviah 2:2:”Whoever is insolent, cruel, hates his fellow man or lacks kindness, is suspected of being a Gibeonite.” The word “rachamim”[mercy] comes from “rechem”, [womb]. There is no mercy like that of a mother for the child of her womb. There is an inseparable bond between them because the child is part of her body, “flesh of her flesh” (Gen. 2:23). Just so must be a Jew's mercy for his fellow Jew (if that fellow is worthy). It should resemble a mother's mercy for her child.
[Joseph's brothers perceived that their father was dead, and they said, “Perhaps Joseph will nurse hatred against us and then he will surely repay us all the evil that we did him.” So they instructed that Joseph be told, “Your father gave orders before his death, saying:'Thus shall you say to Joseph:”O please, kindly forgive the spiteful deed of your brothers and their sin, for they have done you evil'”; so now, please forgive the spiteful deed of the servant of your father's G-d.” And Joseph wept when they spoke to him. His brothers also went and flung themselves before him and said, “We are ready to be your slaves.” But Joseph said to them, Fear not, for am I instead of G-d? Although you intended me harm, G-d intended it for good: in order to accomplish – it is as clear as this day- that a vast people be kept alive. So now, fear not – I will sustain you and your young ones.” Thus he comforted them and spoke to their heart. (Gen.50:15-21)]
[But, as Rabbi Kahane puts it in Peirush HaMaccabee on Shemot, Chapter 1]: To burn evil out of our midst – this is the greatest compassion for the world, for all who are compassionate to the cruel will eventually be cruel to the compassionate (Tanhuma, Metzora 1); because this convoluted compassion allows the wicked to continue to commit evil.
In The Jewish Idea, the chapter on revenge explains this further]: Love has its place, as does hate. Peace has its place, as does war. Mercy has its place, as do cruelty and revenge. The Torah dons sackcloth over the distortion of the concept of revenge, which has become a target for the arrows of all Jewish Hellenists and worshipers of the alien culture, as if revenge were negative and evil by nature. The very opposite is true! No trait is more justified than revenge in the right time and place. G-d, Himself, is called Nokem, Avenger: “The L-rd is a zealous and avenging G-d. The L-rd avenges and is full of wrath. He takes revenge on His adversaries and reserves wrath for His enemies.”(Nachum 1:2). Our sages also said (Berachot 33a), “Shall we say that even revenge is great, because it appears between two names of G-d?” 'A G-d of vengeance is the L-rd' (Ps. 94:1). R. Elazar responded, 'Indeed. Where revenge is necessary, it is a great thing'” [see Rashi].
“It is a great thing!” It is a great mitzvah to take the revenge of the righteous and humble from the evildoer. Whoever forgoes such an opportunity is cruel, and he denies belief in G-d.