It is narrated from Sayyiduna Ibn Abbas (may Allah be pleased with them both) that the Messenger of Allah (peace and blessings be upon him) said: "The pen has been lifted from three: from the one sleeping until he wakes up, from the insane until he regains his senses, and from the child until he attains understanding or reaches puberty."
Hadith Referenceالمعجم الكبير للطبراني / باب العين / 11095