It is narrated from Sayyiduna Ali (may Allah be pleased with him) that the Messenger of Allah (peace and blessings be upon him and his family) said: The pen has been lifted from three individuals: from the child until he reaches puberty, from the sleeping person until he wakes up, and from the insane person until his condition passes.
Hadith Referenceالفتح الربانی / كتاب الصلاة / 1095