Is prayer valid when performed behind an insane person?
Chapter on Imamate and Congregational Prayer
Al-Mughni
Book of Prayer
Primary text
Prayer performed behind an insane person is invalid because the prayer of the insane person himself is nullified. If a person experiences insanity intermittently, and prays behind the insane person while lucid, the prayer behind him is valid.
Supporting text
It is disliked (makruh) to follow an intermittently insane person in prayer, for two reasons: first, in case the insane person experienced a nocturnal emission (ihtilam) during his insanity and it is unknown; and second, to avoid potentially invalidating the prayer mid-act should insanity return, although the prayer remains valid based on the principle that soundness is the default, and it is not invalidated merely by possibility.