عَنْ أَبِي هُرَيْرَةَ رَضِيَ اللَّهُ عَنْهُ عَنِ النَّبِيِّ صَلَّى اللهُ عَلَيْهِ وَسَلَّمَ قَالَ: «إِنَّ اللَّهَ تَجَاوَزَ عَنْ أُمَّتِي مَا حَدَّثَتْ بِهِ أَنْفُسَهَا، مَا لَمْ تَعْمَلْ أَوْ تَتَكَلَّمْ».
The Prophet (may Allah's peace and blessings be upon him) informs that a Muslim will not be held accountable for evil thoughts he has in his mind before he acts upon them or speaks about them, as Allah has lifted the restriction and pardoned. He does not hold the Ummah of Muhammad (may Allah's peace and blessings be upon him) accountable for what comes to their minds and wavers in their souls, without being settled therein.
If it settles in a person's heart, like arrogance, conceit, or hypocrisy, or he acts upon it with his limbs or says it with his tongue, then he will be held accountable for that.
Download for free and never miss a prayer again