On one occasion I was riding behind my friend on a motorcycle and he “popped a wheelie” (lifted the front wheel off the ground), and I reviled the Lord, Allah forbid. Then I repented from this but waswas (satanic whispers) came to me telling me that because the incident took me by surprise, I was not thinking and I will not be brought to account for it. Similarly, this waswas comes to me about many occasions on which I have reviled Allah, Islam and the Prophet (peace and blessings of Allah be upon him), Allah forbid. This has made me doubt myself: did I do it deliberately or not? Especially since these incidents happened to me a number of years ago and I do not remember the details precisely, so I say: O Allah, if I did it deliberately and with intent, then I repent from it.
Reviling Allah or reviling Islam constitutes kufr (disbelief) and apostasy from Islam, according to scholarly consensus. The one who does it has to repent sincerely to Allah, by regretting what has happened and resolving not to go back to it again. If he repents, Allah will accept his repentance. Allah, may He be exalted, says (interpretation of the meaning):
“Say: O ‘Ibadi (My slaves) who have transgressed against themselves (by committing evil deeds and sins)! Despair not of the mercy of Allah, verily, Allah forgives all sins. Truly, He is Oft‑Forgiving, Most Merciful.”
It was narrated from Abu Moosa (may Allah be pleased with him) that the Prophet (peace and blessings of Allah be upon him) said: “Allah holds out His hand at night to accept the repentance of those who have sinned during the day, and He holds out his hand by day to accept the repentance of those who have sinned at night – until the sun rises from its place of setting.” [Muslim].
So you have to repent, turn to Allah and do a lot of righteous deeds. As for thinking about whether this reviling was done deliberately or not, this is whispers from the shaytan (devil) who wants to distract you from repenting or weaken your fear of Allah and your efforts to do righteous deeds. If you understand the abhorrent nature of what you did, and its grave seriousness, this will make you strive to do good and will generate in your heart feelings of submission and humility before Allah; it will make you pin your hopes on His grace, kindness and forgiveness. But if your nafs (self/ego) makes falsehood appealing to you, and makes the offence seem less serious by claiming that it was done in a state of anger, then this will weaken your resolve and lessen your desire to turn to Allah.
You should understand that the kind of anger that causes a person to lose his mind, that a person may be excused for, is that which causes him to lose the ability to distinguish matters to such an extent that he does not know what he is saying. If this happens once, it does not happen repeatedly. Many of those who have the problem of reviling Islam, or reviling Allah or reviling His Messenger (peace and blessings of Allah be upon him) would not be able to revile their fathers or a person whom they hold in high esteem or the father of his opponent and the like, no matter how intense his anger is, but he can revile Islam because of the lack of faith in his heart and his lack of respect for Allah and for His Messenger (peace and blessings of Allah be upon him) and His religion. We ask Allah to keep us safe and sound. If there were any faith in the heart of such a person, it would prevent him from speaking in this abhorrent manner. Hence we say: Ignore this waswas, for you have committed the greatest evil, but you have a Lord Who is Most Merciful and Most Kind; He accepts the repentance of the penitent, forgives the sinner, and turns bad deeds into good. So make your resolve firm, fill your heart with respect for Allah, may He be exalted, and respect for His religion, and read a great deal of the Quran and do a lot of righteous deeds.
We ask Allah to accept your repentance and forgive you your sins.
And Allah knows best.