Book of Fasting
Chapter: Those for whom fasting is obligatory and the age of puberty that makes the duties and legal penalties binding
Fasting is obligatory for every male who has experienced a seminal dream and every female who has begun to menstruate, whether they are free or enslaved Muslims, so long as they have not lost their mental faculties through persistent insanity, intellectual disability, or obsessive delusion.
Mālik regarded persistent insanity as analogous to unconsciousness and to menstruation. He therefore said: “Whoever becomes unconscious during the month of Ramadan, or lapses into insanity in that month and then recovers, must make up the fast but is not required to make up the prayer.” In my opinion—and Allah knows best—this applies to someone whose madness recurs: he loses and regains his sanity from time to time, and such a person is comparable to one who is merely unconscious.
Ibn al-Qāsim, however, relates from Mālik that if a person reaches puberty while suffering continuous insanity, remains in that state for years, and then regains his reason, he must make up the fasts of those years but not the prayers, exactly like a menstruating woman.
Ibn Ḥabīb said: