It is narrated from several Companions of the Messenger of Allah (peace and blessings be upon him), among them Sayyiduna Shaddad bin Aws and Thawban (may Allah be pleased with them both), that the Messenger of Allah (peace and blessings be upon him) said: "The pen has been lifted, with regard to the prescribed punishment (hadd), from the young child until he grows up, from the sleeper until he wakes, from the insane person until he recovers, and from the feeble-minded, ruined person."
Hadith Referenceالمعجم الكبير للطبراني / باب الشين / 7125