The same applies to an insane person, for his insanity precludes the validity of the faith and acts of worship that are prerequisites for friendship with Allah. As for someone who is sometimes insane and sometimes lucid, if, during his lucid periods, he believes in Allah and His Messenger, fulfils his obligations, and avoids what is forbidden, then his insanity does not prevent Allah from rewarding him for the faith and fear of Allah he displayed while lucid. His share of friendship with Allah will be commensurate with that.
Likewise, if someone becomes insane after having had faith and feared Allah, Allah will reward and recompense him for his previous faith and fear of Him. He will not nullify that because of the insanity with which the person has been afflicted through no sin of his own. During his insanity, he is not held accountable.
Accordingly, if someone presents himself as a friend of Allah while neither fulfilling his obligations nor avoiding what is forbidden—and may even do things contrary to these requirements—no one may say, “This is a friend of Allah.” If such a person is not insane, but is merely bewildered without being insane, or if he loses his reason through insanity at times and regains it at others, yet does not fulfil his obligations and instead believes that he is not obliged to follow the Messenger, peace and blessings be upon him, then he is a disbeliever. If, however, he is insane both inwardly and outwardly and is no longer held accountable, then, although he is not punished as disbelievers are punished, he is not entitled to the honour from Allah, Mighty and Majestic, to which people of faith and fear of Allah are entitled. In neither case may anyone believe him to be a friend of Allah. But if he had a lucid period during which he believed in Allah and feared Him, his share of friendship with Allah would be commensurate with that.