The answer to this question may be given by addressing the two following issues:
1 – The ruling on one who insults the Prophet (peace and blessings of Allaah be upon him)
The scholars are unanimously agreed that a Muslim who insults the Prophet (peace and blessings of Allaah be upon him) becomes a kaafir and an apostate who is to be executed. This consensus was narrated by more than one of the scholars, such as Imaam Ishaaq ibn Raahawayh, Ibn al-Mundhir, al-Qaadi ‘Iyaad, al-Khattaabi and others. Al-Saarim al-Maslool, 2/13-16
This ruling is indicated by the Qur’aan and Sunnah.
In the Qur’aan it says (interpretation of the meaning):
“The hypocrites fear lest a Soorah (chapter of the Qur’aan) should be revealed about them, showing them what is in their hearts. Say: ‘(Go ahead and) mock! But certainly Allaah will bring to light all that you fear.’
If you ask them (about this), they declare: ‘We were only talking idly and joking.’ Say: ‘Was it at Allaah, and His Ayaat (proofs, evidences, verses, lessons, signs, revelations, etc.) and His Messenger that you were mocking?’
Make no excuse; you disbelieved after you had believed”
[al-Tawbah 9:64-66]
This verse clearly states that mocking Allaah, His verses and His Messenger constitutes kufr, so that applies even more so to insulting. The verse also indicates that whoever belittles the Messenger of Allaah (peace and blessings of Allaah be upon him) is also a kaafir, whether he was serious or joking.
With regard to the Sunnah, Abu Dawood (4362) narrated from ‘Ali that a Jewish woman used to insult the Prophet (peace and blessings of Allaah be upon him) and say bad things about him, so a man strangled her until she died, and the Prophet (peace and blessings of Allaah be upon him) ruled that no blood money was due in this case.
Shaykh al-Islam Ibn Taymiyah said in al-Saarim al-Maslool (1/162): This hadeeth is jayyid, and there is a corroborating report in the hadeeth of Ibn ‘Abbaas which we will quote below.
This hadeeth clearly indicates that it was permissible to kill that woman because she used to insult the Prophet (peace and blessings of Allaah be upon him).
Abu Dawood (4361) narrated from Ibn ‘Abbaas that a blind man had a freed concubine (umm walad) who used to insult the Prophet (peace and blessings of Allaah be upon him) and say bad things about him. He told her not to do that but she did not stop, and he rebuked her but she did not heed him. One night, when she started to say bad things about the Prophet (peace and blessings of Allaah be upon him) and insult him, he took a short sword or dagger, put it on her belly and pressed it and killed her. The following morning that was mentioned to the Messenger of Allaah (peace and blessings of Allaah be upon him). He called the people together and said, “I adjure by Allah the man who has done this action and I adjure him by my right over him that he should stand up.” The blind man stood up and said, “O Messenger of Allaah, I am the one who did it; she used to insult you and say bad things about you. I forbade her, but she did not stop, and I rebuked her, but she did not give up her habit. I have two sons like pearls from her, and she was kind to me. Last night she began to insult you and say bad things about you. So I took a dagger, put it on her belly and pressed it till I killed her.” Thereupon the Prophet (peace and blessings of Allaah be upon him) said: “Bear witness, there is no blood money due for her.”
(Classed as saheeh by al-Albaani in Saheeh Abi Dawood, 3655)
It seems that this woman was a kaafir, not a Muslim, for a Muslim could never do such an evil action. If she was a Muslim she would have become an apostate by this action, in which case it would not have been permissible for her master to keep her; in that case it would not have been good enough if he were to keep her and simply rebuke her.
Al-Nasaa’i narrated (4071) that Abu Barzah al-Aslami said: A man spoke harshly to Abu Bakr al-Siddeeq and I said, ‘Shall I kill him?’ He rebuked me and said, ‘That is not for anyone after the Messenger of Allaah (peace and blessings of Allaah be upon him) .’” (Saheeh al-Nasaa’i, 3795)
It may be noted from this that the Prophet (peace and blessings of Allaah be upon him) had the right to kill whoever insulted him and spoke harshly to him, and that included both Muslims and kaafirs.
The second issue is: if a person who insulted the Prophet (peace and blessings of Allaah be upon him) repents, should his repentance be accepted or not?
The scholars are agreed that if such a person repents sincerely and regrets what he has done, this repentance will benefit him on the Day of Resurrection and Allaah will forgive him.
But they differed as to whether his repentance should be accepted in this world and whether that means he is no longer subject to the sentence of execution.
Maalik and Ahmad were of the view that it should not be accepted, and that he should be killed even if he has repented.
They quoted as evidence the Sunnah and proper understanding of the ahaadeeth:
In the Sunnah, Abu Dawood (2683) narrated that Sa’d ibn Abi Waqqaas said: “On the Day of the Conquest of Makkah, the Messenger of Allaah (peace and blessings of Allaah be upon him) granted safety to the people except for four men and two women, and he named them, and Ibn Abi Sarh… As for Ibn Abi Sarh, he hid with ‘Uthmaan ibn ‘Affaan, and when the Messenger of Allaah (peace and blessings of Allaah be upon him) called the people to give their allegiance to him, he brought him to stand before the Messenger of Allaah (peace and blessings of Allaah be upon him). He said, “O Prophet of Allaah, accept the allegiance of ‘Abd-Allaah.” He raised his head and looked at him three times, refusing him, then he accepted his allegiance after the third time. Then he turned to his companions and said: “Was there not among you any smart man who could have got up and killed this person when he saw me refusing to give him my hand and accept his allegiance?” They said, “We do not know what is in your heart, O Messenger of Allaah. Why did you not gesture to us with your eyes?” He said, “It is not befitting for a Prophet to betray a person with a gesture of his eyes.”
(Classed as saheeh by al-Albaani in Saheeh Abi Dawood, 2334)
This clearly indicates that in a case such as this apostate who had insulted the Prophet (S), it is not obligatory to accept his repentance, rather it is permissible to kill him even if he comes repentant.
‘Abd-Allaah ibn Sa’d was one of those who used to write down the Revelation, then he apostatized and claimed that he used to add whatever he wanted to the Revelation. This was a lie and a fabrication against the Prophet (peace and blessings of Allaah be upon him), and it was a kind of insult. Then he became Muslim again and was a good Muslim, may Allaah be pleased with him. Al-Saarim 115.
With regard to proper understanding of the ahaadeeth:
They said that insulting the Prophet (peace and blessings of Allaah be upon him) has to do with two rights, the right of Allaah and the right of a human being. With regard to the right of Allaah, this is obvious, because it is casting aspersions upon His Message, His Book and His Religion. As for the right of a human being, this is also obvious, because it is like trying to slander the Prophet (peace and blessings of Allaah be upon him) by this insult. In a case which involves both the rights of Allaah and the rights of a human being, the rights of the human beings are not dropped when the person repents, as in the case of the punishment for banditry, because if the bandit has killed someone, that means that he must be executed and crucified. But if he repents before he is caught, then the right of Allaah over him, that he should be executed and crucified, no longer applies, but the rights of other humans with regard to qisaas (retaliatory punishment) still stand. The same applies in this case. If the one who insulted the Prophet (peace and blessings of Allaah be upon him) repents, then the rights of Allaah no longer apply, but there remains the right of the Messenger of Allaah (peace and blessings of Allaah be upon him), which still stand despite his repentance.
If it is said, “Can we not forgive him, because during his lifetime the Prophet (peace and blessings of Allaah be upon him) forgave many of those who had insulted him and he did not execute them?” The answer is:
The Prophet (peace and blessings of Allaah be upon him) sometimes chose to forgive those who had insulted him, and sometimes he ordered that they should be executed, if that served a greater purpose. But now his forgiveness is impossible because he is dead, so the execution of the one who insults him remains the right of Allaah, His Messenger and the believers, and the one who deserves to be executed cannot be let off, so the punishment must be carried out.
Al-Saarim al-Maslool, 2/438
Insulting the Prophet (peace and blessings of Allaah be upon him) is one of the worst of forbidden actions, and it constitutes kufr and apostasy from Islam, according to scholarly consensus, whether done seriously or in jest. The one who does that is to be executed even if he repents and whether he is a Muslim or a kaafir. If he repents sincerely and regrets what he has done, this repentance will benefit him on the Day of Resurrection and Allaah will forgive him.
Shaykh al-Islam Ibn Taymiyah (may Allaah have mercy on him) wrote a valuable book on this matter, entitled al-Saarim al-Maslool ‘ala Shaatim al-Rasool which every believer should read, especially in these times when a lot of hypocrites and heretics dare to insult the Messenger (peace and blessings of Allaah be upon him) because they see that the Muslims are careless and feel little protective jealousy towards their religion and their Prophet, and they do not implement the shar’i punishment which would deter these people and their ilk from committing this act of blatant kufr.