If this is an OCD and doctors say that this is an illness, there is nothing for you to do as you are sick. No one in his right mind and Islam would dare and do such a thing even if he claims he didn’t intend it.

A person had a bad thought which could be in disrespect to Allah and the Book of Allah or anything relating to mockery or disrespect to the wives of the Prophet (salla Allahu aleyhi wa sallam) and ends up laughing at that thought…or smiling at that thought but it happens as a sudden reaction to the thought. i.e you try to force back the laughter or smile and dont intend to commit any kufr by it and know its wrong or sometimes your reaction is sudden and you realise after that it was wrong, but again dont mean any kufr or dont intend kufr by it.

Psychological and Social Problems |