The mitzvah to bless the nation applies to all Kohanim, righteous or evil. Therefore, even a Kohen who sins by eating forbidden foods, having forbidden relations, or committing other sins (excluding those to be outlined in the following paragraphs) is obligated to ascend the duchan to recite the blessing. If he refrains from blessing, he only adds insult to injury. As the Rambam writes (Hilchot Tefillah 15:6), “Do not tell an evil person, ‘Do more evil and refrain from performing mitzvot.’”
It is not surprising how an evil Kohen can bless Israel, because in truth, it is Hashem Who blesses His nation of Israel with love. In order for the blessing to be revealed in the world, the Kohanim are commanded to utter the prayer with their lips. Consequently, Israel will strengthen its awareness that Hashem is the source of blessing in the world. Since the Kohanim in general are the group granted the holiest tasks from among the Jewish people, they were chosen to express the Divine Will to bless the nation of Israel. Yet, the berachah is not dependent on the personal righteousness of the Kohen who blesses, but on God’s desire to bless His people (Rambam ibid., 7; and see Olat Ra’ayah, part 1, p. 283).
However, if the Kohen commits sins which mar his priesthood, the Chachamim penalize him and forbid his ascent to the duchan. For instance, a Kohen who marries a divorcee is prohibited from reciting Birkat Kohanim. Similarly, a Kohen who is not careful to avoid becoming contaminated by the impurity of the dead is forbidden to bless the people. The reason is that since these prohibitions were intended to preserve the special sanctity of the Kohanim, one who transgresses them damages his priesthood, and therefore the Chachamim penalize him by forbidding him to ascend the duchan. Likewise, he is not called up to the Torah for the special aliyah of the Kohanim.
If he decides to repent, he must first divorce his forbidden wife and vow in public not to marry women who are prohibited to him again. Only after that may he resume his priestly task of blessing the people. Likewise, if he was accustomed to becoming contaminated by the dead, he must accept upon himself not to do so again (Shulchan Aruch 128:40-41).
A Kohen who worshiped idols is disqualified from reciting Birkat Kohanim. We learn this from the law of the Temple service; just as a Kohen who worships idols is ineligible to perform the Temple service, so too, he is unfit to bless the people (Menachot 109a and Tosafot there). However, if he repents completely, he may resume his priestly duties and bless the nation (Shulchan Aruch 128:37).
There are poskim who equate the law concerning one who publicly (meaning in front of ten Jews) desecrates the Shabbat, to the law of a person who worships idols, and they maintain that a Kohen who does so is forbidden to ascend the duchan. That is how the Mishnah Berurah rules (128:134). However, according to a number of eminent Acharonim, even a Kohen who desecrates the Shabbat is permitted to ascend the duchan, for a number of reasons. First, it is not clear that the law concerning one who desecrates the Shabbat is, indeed, like that of an idol worshiper. Secondly, a distinction must be made between those who desecrate the Shabbat nowadays and those who did so in the past. In the past, it was clear that anyone who desecrated the Shabbat publicly did so partly in defiance of the Torah and the mitzvot. However, today, those who desecrate the Shabbat do not intend to purposely incite God’s wrath. Even if they publicly violate the laws of Shabbat, it is due to a lack of faith and learning, and not from an intention to arouse anger and to antagonize. Therefore, a Kohen who desecrates the Shabbat without intending to desecrate Hashem’s Name and offend the Torah is permitted to ascend the duchan, according to the lenient opinion.
However, the law regarding a Kohen who desecrates the Shabbat in order to purposely incite God’s wrath is different. This includes a Kohen who participates in organizing communal desecration of the Shabbat. This includes organizing bus rides on Shabbat, partaking in a demonstration in favor of opening businesses and movie theaters on Shabbat. As long as he does not repent, he is like an idol worshiper and is deemed unfit to ascend the duchan.
. Some are lenient so that the children of these Kohanim will not be mistaken for not being Kohanim and subsequently marry women who are forbidden to all Kohanim. So writes Achiezer, part 4, 3, and what is brought in the name of the Aderet. The Igrot Moshe, Orach Chaim 1:33 writes that, in principle, one who desecrates the Shabbat is permitted to bless the nation. There, in part 2, 4 he writes that the Levushei Mordechai is also lenient regarding this. See earlier in this book, chapter 2, note 10, that some Acharonim allow one who desecrates the Shabbat to join a minyan, since today such a person does not sin intentionally to arouse anger.