Hadith 7169
عَنْ عَائِشَةَ رضي الله عنها عَنِ النَّبِيِّ صلى الله عليه وآله وسلم قَالَ: ((رُفِعَ الْقَلَمُ عَنْ ثَلَاثَةٍ، عَنِ الصَّبِيِّ حَتَّى يَحْتَلِمَ وَعَنِ النَّائِمِ حَتَّى يَسْتَيْقِظَ، وَعَنِ الْمَعْتُوهِ حَتَّى يَعْقِلَ))۔
It is narrated from Sayyida Aisha (may Allah be pleased with her) that the Noble Prophet (peace and blessings be upon him) said: Three types of people are exempt from accountability (i.e., free from punishment for sins): first, a minor child until he reaches maturity; second, a sleeping person until he wakes up; and third, an insane person until his mental balance is restored.
Hadith 7170
عَنْ أَبِي هُرَيْرَةَ قَالَ: قَالَ رَسُولُ اللَّهِ صلى الله عليه وآله وسلم: ((تُجُوِّزَ (وَفِي لَفْظٍ: أَنَّ اللَّهَ تَجَاوَزَ) لِأُمَّتِي عَمَّا حَدَّثَتْ فِي أَنْفُسِهَا أَوْ وَسْوَسَتْ بِهِ أَنْفُسُهَا مَا لَمْ تَعْمَلْ بِهِ أَوْ تَتَكَلَّمْ بِهِ))۔
It is narrated from Sayyiduna Abu Hurairah (may Allah be pleased with him) that the Noble Prophet (peace and blessings be upon him) said: Allah Almighty has pardoned my Ummah for (corrupt) thoughts and inner whispers that arise in their hearts, as long as they are not acted upon or spoken about.