One of the basic principles among Ahl al-Sunnah wa’l-Jamaa’ah is that good deeds are not accepted if they are accompanied by kufr, and that nothing cancels out all good deeds except kufr.
This is indicated by the verse in which Allaah says (interpretation of the meaning):
“Say: Spend (in Allaah’s Cause) willingly or unwillingly, it will not be accepted from you. Verily, you are ever a people who are Faasiqoon (rebellious, disobedient to Allaah).”
54. And nothing prevents their contributions from being accepted from them except that they disbelieved in Allaah and in His Messenger (Muhammad), and that they came not to As-Salaah (the prayer) except in a lazy state, and that they offer not contributions but unwillingly”
Ibn Taymiyah (may Allaah have mercy on him) said:
Nothing cancels out good deeds except kufr, because the one who dies as a believer will inevitably enter Paradise, and he will be brought out of Hell if he does enter it, but if all his good deeds are cancelled out, he will never enter Paradise. Good deeds can only be cancelled out by that which is their opposite, and nothing can be the opposite of all good deeds except kufr. This is well known from the principles of Sunnah. End quote. Al-Saarim al-Maslool (p. 55)
The followers of innovation, such as the Khawaarij, Mu’tazilah and Murji’ah differed. The Khawaarij and Mu’tazilah went to extremes and said that major sins erase and cancel out all good deeds and acts of worship. In contrast the Murji’ah said that the good deed of faith cancels out all bad deeds.
Once it is understood that nothing can cancel out all good deeds except that which cancels out faith altogether, namely kufr, then can some sins cancel out and erase some good deeds?
Shaykh al-Islam Ibn Taymiyah (may Allaah have mercy on him) said inMajmoo’ al-Fataawa (10/638):
If bad deeds do not cancel out all good deeds, can they cancel out a proportional amount of them, or can some good deeds be erased by sin that is less than kufr?
There are two views among those who claim adherence to the Sunnah, some who deny that and some who affirm it. End quote.
The first view is that bad deeds do not cancel out good deeds, rather good deeds are the ones that cancel out bad deeds, by the grace and bounty and kindness of Allaah.
Al-Qurtubi (may Allaah have mercy on him) said in al-Jaami’ li Ahkaam al-Qur’aan (3/295):
The correct ‘aqeedah is that bad deeds do not cancel out good deeds. End quote.
The second view is that sins and innovations may cancel out the reward for good deeds as a form of punishment. Shaykh al-Islam Ibn Taymiyah attributed this view to the majority of Ahl al-Sunnah. SeeMajmoo’ al-Fataawa (10/322).
This was also the view favoured by Shaykh al-Islam and his student Ibn al-Qayyim. He said in Madaarij al-Saalikeen (1/278):
Ahmad stated that in one report and said: A person should get married if he fears for himself; he should borrow money and get married, lest he fall into haraam actions which would cancel out his good deeds. End quote.
Imam al-Bukhaari (may Allaah have mercy on him) said in Kitaab al-Eemaan (the Book of Faith) in his Saheeh:
Chapter: Fear of the believer inadvertently cancelling out his good deeds. Ibraaheem al-Taymi (may Allaah have mercy on him) said: When I compare my words with my deeds, I am afraid that my deeds belie my words. Ibn Abi Mulaykah said: I met thirty of the companions of the Prophet (peace and blessings of Allaah be upon him) all of whom feared that they might be guilty of hypocrisy, and not one of them said that his faith was like that of Jibreel and Mika’eel. It was narrated from al-Hasan: No one fears it (hypocrisy) but a believer and no one feels safe from it but a hypocrite. And one should be afraid of persisting in hypocrisy and sin without repenting, because Allaah says (interpretation of the meaning): “and [they] do not persist in what (wrong) they have done, while they know” [Aal ‘Imraan 3:135].
Imam Muslim also entitled a chapter: The believer’s fear of his good deeds being cancelled out.
Imam Ibn Rajab (may Allaah have mercy on him) said:
Al-Bukhaari’s title for this chapter is suited to what is mentioned in it of good deeds being cancelled out by some sins, as Allaah says (interpretation of the meaning):
“O you who believe! Raise not your voices above the voice of the Prophet, nor speak aloud to him in talk as you speak aloud to one another, lest your deeds should be rendered fruitless while you perceive not”
Imam Ahmad said: Al-Hasan ibn Moosa said: Hammad ibn Salamah narrated from Habeeb ibn al-Shaheed, that al-Hasan said: These people do not think that some deeds can cancel out others, but Allaah says (interpretation of the meaning):
“O you who believe! Raise not your voices …, lest your deeds should be rendered fruitless while you perceive not”
This is also indicated by the verses in which Allaah says (interpretation of the meaning):
“O you who believe! Do not render in vain your Sadaqah (charity) by reminders of your generosity or by injury, like him who spends his wealth to be seen of men, and he does not believe in Allaah, nor in the Last Day. His likeness is the likeness of a smooth rock on which is a little dust; on it falls heavy rain which leaves it bare. They are not able to do anything with what they have earned. And Allaah does not guide the disbelieving people”
“Would any of you wish to have a garden with date palms and vines, with rivers flowing underneath, and all kinds of fruits for him therein, while he is stricken with old age, and his children are weak (not able to look after themselves), then it is struck with a fiery whirlwind, so that it is burnt? Thus does Allaah make clear His Ayaat (proofs, evidences, verses) to you that you may give thought”
In Saheeh al-Bukhaari it is narrated that ‘Umar asked the people about it and they said: Allaah knows best. Ibn ‘Abbaas said: The verse gives a likeness of deeds. ‘Umar said: What deeds? Ibn ‘Abbaas said: Deeds. ‘Umar said: A rich man may strive in obedience of Allaah, then Allaah sends the shaytaan to him and he commits sins until they drown out his good deeds.
‘Ata’ al-Khursaani said: This is a man whose deeds end with shirk or a major sin, so all his good deeds are cancelled out.
It is narrated in a saheeh report that the Prophet (peace and blessings of Allaah be upon him) said: “Whoever does not pray ‘Asr, his deeds are cancelled out.” Narrated by al-Bukhaari (553).
It also says in al-Saheeh that a man said: By Allaah, Allaah will not forgive So and so. Allaah said: ‘Who is the one who swore by Me that I will not forgive So and so? I have forgiven So and so and I have cancelled out your good deeds. Muslim (2621).
‘Aa’ishah (may Allaah be pleased with her) said: Tell Zayd that his jihad with the Messenger of Allaah (S) will be cancelled out unless he repents. Narrated by al-Daaraqutni (3/52) and al-Bayhaqi (5/330)
This indicates that some bad deeds cancel out some good deeds, but they may be restored if one repents.
Ibn Abi Haatim narrated in his Tafseer from Abu Ja’far, from al-Rabee’ ibn Anas, that Abu’l-Aaliyah said: The companions of the Messenger of Allaah (peace and blessings of Allaah be upon him) thought that no sin could do harm if one was sincere and that no good deed was of any avail if one associates others with Allaah. Then Allaah revealed the words (interpretation of the meaning):
“O you who believe! Obey Allaah, and obey the Messenger (Muhammad) and render not vain your deeds”
Then they began to fear major sins after they found out that they may cancel out good deeds.
It was narrated from al-Hasan that he said concerning the words “and render not vain your deeds” i.e., by committing sins. It was narrated from Ma’mar from al-Zuhri concerning the words “and render not vain your deeds” i.e., by committing major sins.
It was narrated that Qataadah said concerning this verse: Whoever among you can avoid rendering vain his righteous deeds by doing bad deeds, let him do so, and there is no strength except with Allaah. Good cancels out evil, and evil cancels out good, and what matters is one’s final deeds.
Ibn Rajab (may Allaah have mercy on him) said: There are very many reports from the salaf about good deeds being cancelled out by major sins, and it would take too long to list them all. Hudhayfah said: Slandering a chaste innocent woman cancels out the good deeds of a hundred years.
It was narrated that ‘Ata’ said: A man may say a word in anger that destroys the good deeds of sixty or seventy years.
Imam Ahmad said, according to the report of al-Fadl ibn Ziyaad: No one of you can be sure that he will not steal a glance that will cancel out his good deeds.
As for those who say that the view that good deeds may be cancelled out by bad deeds is the view of the Khawaarij and Mu’tazilah, this is a false view, and the views of the righteous salaf do not agree with that. Yes, the Khawaarij and Mu’tazilah said that faith is cancelled out by major sins and that major sin dooms one to spend eternity in Hell, but this is a false view which was held by them alone. Sharh Kitaab al-Eemaan min Saheeh al-Bukhaari (206-210).
Ibn al-Qayyim said: The things that cancel out or spoil good deeds are too many to count. It is not the deeds that count, rather it is the protection of one's good deeds from that which may spoil them or cancel them out. Al-Waabil al-Sayyib (18).
And Allaah knows best.