The ruling on one who curses Islam is that he is a kaafir, because cursing Islam or making fun of it constitutes apostasy from Islam and disbelief in Allaah and in His religion. Allaah tells us of some people who made fun of Islam and then said. We were just joking and playing, but Allaah tells us that this joking and playing is in fact mocking Allaah, His signs and His Messenger, and that they were committing kufr thereby. Allaah says (interpretation of the meaning):
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?
66. Make no excuse; you disbelieved after you had believed'
[al-Tawbah 9:65, 66]
Mocking the religion of Allaah, or cursing the religion of Allaah, or insulting Allaah and His Messenger, or making fun of them, is kufr that puts one beyond the pale of Islam. However there is room for repentance from that, because Allaah says (interpretation of the meaning):
Say: O Ibaadi (My slaves) who have transgressed against themselves (by committing evil deeds and sins)! Despair not of the Mercy of Allaah, verily, Allaah forgives all sins. Truly, He is Oft‑Forgiving, Most Merciful
If a person repents from any kind of apostasy and his repentance is sincere and meets all the conditions of repentance, then Allaah will accept his repentance. There are five conditions of repentance, which are as follows:
1 - Being sincere towards Allaah in repentance, i.e., the motive for repentance should not be a desire to show off, or fear of another person, or the hope for some worldly gain to be made by repenting. If a person's repentance is sincerely for the sake of Allaah alone, and the motive for it is fear of Allaah and fear of His punishment and hope for His reward, then it is sincerely for Allaah alone.
2 - He must regret what he has done of sin, by feeling remorse and sorrow for what has happened in the past, and he should regard it as a serious matter that he has to give up.
3 - He must give up the sin and stop persisting in it. If his sin was omission of an obligatory duty, he must start doing it and make it up if he can. If his sin was commission of a forbidden action he must give it up and keep away from it. If his sin had to do with other people, then he must restore their rights to them or ask for their pardon.
4 - He must resolve not to go back to it in the future, by having the determination in his heart not to go back to the sin from which he has repented.
5 - His repentance must come at the time when it will be accepted. If it comes after that time it will not be accepted. The time of acceptance is general and specific.
The general time is when the sun rises from the west; repentance that comes after the sun rises from the west will not be accepted, because Allaah says (interpretation of the meaning):
The day that some of the Signs of your Lord do come, no good will it do to a person to believe then, if he believed not before, nor earned good (by performing deeds of righteousness) through his Faith. Say: Wait you! we (too) are waiting
The specific time is when death is imminent. When death is imminent repentance will be of no benefit, because Allaah says (interpretation of the meaning):
And of no effect is the repentance of those who continue to do evil deeds until death faces one of them and he says: Now I repent;' nor of those who die while they are disbelievers
I say: if a person repents from any sin - even if that is cursing Islam - then his repentance will be accepted if he meets the conditions mentioned here.
But it should be noted that a word may be an act of kufr or apostasy, but the one who says it may not become a kaafir thereby, if there is a factor present which means that he cannot be judged to be a kaafir. Here we have a man who tells us that he cursed Islam whilst in a state of anger. We say to him: If your anger was so intense that you did not know what you were saying, and at that point you did not know if you were in heaven or on earth, and you said words without thinking or knowing what they were, then these words are not subject to any ruling, and you cannot be judged to be an apostate, because these words were not spoken intentionally. If a word is spoken unintentionally, Allaah will not punish a person for it. Allaah says concerning vows (interpretation of the meaning):
Allaah will not punish you for what is unintentional in your oaths, but He will punish you for your deliberate oaths
If this person who spoke words of kufr in a moment of intense anger did not know what he was saying, then there is no ruling on his words, and he cannot be judged to be an apostate in this case. As he is not judged to be an apostate, his marriage to his wife is not annulled, rather she is still married to him.
But if a person feels angry he should try to counteract this anger in the ways prescribed by the Prophet (peace and blessings of Allaah be upon him) when a man asked him, O Messenger of Allaah, advise me. He said: Do not get angry, and he repeated it several times, saying, Do not get angry. So he must exercise self-control and seek refuge with Allaah from the accursed Shaytaan. If he is standing, he should sit down; if he is sitting, he should lie down. If his anger grows too intense, he should do wudoo'. All these things will take away his anger. How many people have regretted acting upon their anger, but it was too late.
Reproduced from Islam QA