It is narrated from Hazrat Aisha (may Allah be pleased with her) that the Prophet (peace and blessings be upon him) said: Three types of people are exempt from accountability—the pen is lifted from them and no ruling is applied to them: first, the sleeping person until he wakes up; second, the child until he reaches puberty; and third, the insane person until he regains his senses.
Hadith Referenceمسند احمد / مسند النساء / 24694
Hadith Gradingحکم دارالسلام:حديث صحيح، وهذا إسناد فيه شيئ