Purity: Touching a Corpse by a Child or Insane Person
Practical Laws of Islam as per the teachings of Ayatullah Sistani
Ruling 515:
If an insane person or a child who has not reached the age of legal responsibility touches a corpse, then after the insane person becomes sane or the child reaches the age of legal responsibility, he must perform the ghusl for touching a corpse. If the child is mumayyiz [and performs this ghusl], his ghusl is valid.
-Ayatullah Sistani, Practical Laws of Islam, Purification (Taharah)


