حَدَّثَنَا مُوسَى بْنُ إِسْمَاعِيلَ، حَدَّثَنَا وُهَيْبٌ، عَنْ خَالِدٍ، عَنْ أَبِي الضُّحَى، عَنْ عَلِيٍّ، عَلَيْهِ السَّلاَمُ عَنِ النَّبِيِّ صلى الله عليه وسلم قَالَ ‏"‏ رُفِعَ الْقَلَمُ عَنْ ثَلاَثَةٍ عَنِ النَّائِمِ حَتَّى يَسْتَيْقِظَ وَعَنِ الصَّبِيِّ حَتَّى يَحْتَلِمَ وَعَنِ الْمَجْنُونِ حَتَّى يَعْقِلَ ‏"‏ ‏.‏ قَالَ أَبُو دَاوُدَ رَوَاهُ ابْنُ جُرَيْجٍ عَنِ الْقَاسِمِ بْنِ يَزِيدَ عَنْ عَلِيٍّ رضى الله عنه عَنِ النَّبِيِّ صلى الله عليه وسلم زَادَ فِيهِ ‏"‏ وَالْخَرِفِ ‏"‏ ‏.‏

Narrated Ali ibn AbuTalib: The Prophet (PBUH) said: There are three (persons) whose actions are not recorded: a sleeper till he awakes, a boy till he reaches puberty, and a lunatic till he comes to reason. Abu Dawud said: Ibn Juraij has transmitted it from Al-Qasim b. Yazid on the authority of 'Ali from the Prophet (PBUH). This version adds: "and an old man who is feeble-minded." Translation Not Available

Book Ref: Sunan Abi Dawud Book 40 Hadith 4403
Web Ref:  Sunan Abi Dawud Book 39 Hadith 4389