Fatwa: "The Position of a Muslim Towards One Who Slanders the Prophet and His Companions"
Quickly following an attempted attack against the Danish newspaper that printed cartoons depicting the Prophet Muhammad.
Answer: Slander against the prophet (PBUH) and his companions is heresy, and the one who hears it should defend the prophet (PBUH) as well as his companions -- may God be pleased with them. You should inform this person that this act is among the most heinous of crimes, and that he must cease from doing so forthwith, and offer sincere repentance to Almighty God. This should be done with kindness and good advice, for perhaps this was done out of ignorance, or perhaps he was influenced by the environment in which he was brought up. Therefore if he repents to Almighty God and turns away from his evil, then it is acceptable to accompany him (once more). However, if he persists in his wickedness and his attacks against the prophet of God (PBUH) and his companions, and does not benefit from the advice (you gave him), then your duty is to abandon him. Almighty God hath said: "And it has already come down to you in the Book that when you hear the verses of Allah [recited], they are denied [by them] and ridiculed; so do not sit with them until they enter into another conversation. Indeed, you would then be like them. Indeed Allah will gather the hypocrites and disbelievers in Hell all together -" (Qur'an 4.140).
See also the following fatwas: nos. 41439, 29281, and 78218.
(Islamic) scholars have stated that he who reviles the prophet is an infidel, and it is incumbent upon the sultan to kill him, as Khalil said, in brief: "He who reviled a prophet or king, or slandered him, or cursed him, or denounced him, or defamed him, or belittled him, or misrepresented his character, or attached a deficiency to his body, or attributes, or standing, or knowledge, or renounced him, or added unto him what was not permissible for him, or attributed to him what was not worthy of his position by way of slander, or if he said (any of this) about the prophet (PBUH), and cursed and said that he wanted to pierce/prick him; he was killed, and not called to repentance."
Now as for reviling his companions, it is strictly forbidden. This was confirmed for the ex-migrants, for the prophet (PBUH) said: "Do not revile my companions, for even if there were one of you that was worth his price in gold, he would not be worth even half of one of them" (reported in al-Bukhari and Muslim).[...]
Islamweb, Fatwa No. 145841, December 28, 2010