Shaykhul Islam Ibn Taymiyyah rahimahullah said:
ومن كان يجن أحيانا ويفيق أحيانا . إذا كان في حال إفاقته مؤمنا بالله ورسوله ويؤدي الفرائض ويجتنب المحارم ؛ فهذا إذا جن لم يكن جنونه مانعا من أن يثيبه الله على إيمانه وتقواه الذي أتى به في حال إفاقته ويكون له من ولاية الله بحسب ذلك . وكذلك من طرأ عليه الجنون بعد إيمانه وتقواه ؛ فإن الله يثيبه ويأجره على ما تقدم من إيمانه وتقواه
“… And as for he who loses his sanity at times and gains it back at other times, then if he has eemaan in Allah and His Messenger, fulfills the obligations, and avoids the prohibitions [all] when he is a state of sanity, then this [type of] individual, if he loses his sanity, it won’t be a prevention for him to be rewarded by Allaah for his faith and piety which he performed when he gained his sanity back. Also, he will have the position of being a walee [an ally of Allaah] according to what he previously showed [of good deeds]. Likewise, whoever [permanently] loses his sanity after being upon eeman and piety, then surely Allaah will reward him and recompense him for what emanated from him while having eeman and piety…” End quote. [Majmoo’ul Fataawa (191-194/11)]
Note: As for a person who is totally insane, then the scholars unanimously agree that none of his acts of worship are valid and considered. As Shaykhul Islam mentions there is no reward or punishment upon his actions being they are لغو ‘void’
Ash-Shaykh Bin Baaz rahimahullah said:
“…The same ruling applies to the one who is mentally imbalanced, even if they are not insane, but is imbalanced because of old age or a defect that affected his brain and resulted in misbehavior.” End quote. [Reference]
A Side Note: This ruling is of course contrary to a person who suffers from regular mental disorders [i.e psychological disorders].
Listen / Download
Shaykh Muhammad bin Saalih al-Uthaymeen rahimahullah mentions in the clip above that حالة نفسية regular psychological disorders [i.e depression, etc], takes the ruling of a calamity which is an expiation for the person if he is patient.
AbdulFattaah Bin Uthman