Will the person who commits a major sin be punished if his good deeds outweigh his bad deeds?
Question

I find a contradiction in the views of the scholars concerning two matters, as they say that the one who commits a major sin is subject to the will of Allah, if He will sHe will punish him and if He wills He will forgive him, whilst they also say that the one whose good deeds outweigh his bad deeds will be one of the people of Paradise. What is the solution to this problem? It is as follows: in the case of the one who commits a single major sin, if his good deeds outweigh his bad deeds, can we say that he is promised Paradise and will not be one of the people of Hell, or can we say that he is subject to the will of Allah, and if He wills He will punish him and if He wills He will forgive him?
Praise be to Allah.There is no contradiction between the views of the scholars concerning this issue, praise be to Allah. That may be explained as follows: 
Firstly: 
Ahl as-Sunnah wa’l-Jamaa‘ah are unanimously agreed that in the case of one who has committed major sins, if he meets Allah, may He be exalted, having repented sincerely from it, Allah will not punish him for it or take him to task for it, because the one who repents from sin is like one who did not commit sin. Allah, may He be exalted, says (interpretation of the meaning):
“Except those who repent and believe (in Islamic Monotheism), and do righteous deeds; for those, Allah will change their sins into good deeds, and Allah is Oft‑Forgiving, Most Merciful” [al-Furqaan 25:70]. 
Secondly: 
The one who meets Allah having not repented from his major sin is subject to the will of Allah: if He wills He will punish him and if He wills He will forgive him. This is unlike the view of those who say that the warning of punishment will inevitably be carried out on those who commit major sins, and even ruled that they will abide for ever in Hell because of that, such as the Khawaarij and Mu‘tazilah, or – on the other hand – those who denied that the warning of punishment will ever be carried out on any of the “people of the qiblah”, such as the extreme Murji’ah. 
Allah, may He be exalted, says (interpretation of the meaning):
“Verily, Allah forgives not that partners should be set up with him in worship, but He forgives except that (anything else) to whom He pleases” [an-Nisa’ 4:48]. 
Ibn Jareer at-Tabari (may Allah have mercy on him) said: 
This verse highlights the fact that anyone who commits a major sin is subject to the will of Allah: if He wills He will forgive him for it, and if He wills He will punish him for it, so long as his major sin is not that of ascribing partners to Allah (shirk). End quote. Tafseer at-Tabari (8/450) 
Thirdly: 
When a person who affirmed the Oneness of Allah (Tawheed) but committed sins, major or otherwise, meets Allah, if his good deeds outweighed his bad deeds, he will enter Paradise and will not be punished, but if his bad deeds outweighed his good deeds, he will enter Hell in a manner commensurate with his bad deeds, then his ultimate destination will be Paradise. 
Allah, may He be exalted, says (interpretation of the meaning):
“… So as for those whose scale (of good deeds) will be heavy, they will be the successful (by entering Paradise).
And as for those whose scale will be light, they are those who will lose their ownselves (by entering Hell) because they denied and rejected Our Ayat (proofs, evidences, verses, lessons, signs, revelations, etc)” [al-A‘raaf 7:8-9].
“Then as for him whose balance (of good deeds) will be heavy,
He will live a pleasant life (in Paradise).
But as for him whose balance (of good deeds) will be light,
He will have his home in Hawiyah (pit, i.e. Hell)” [al-Qaari‘ah 101:6-9]. 
Shaykh al-Islam (may Allah have mercy on him) said:
The Sahaabah and Ahl as-Sunnah are of the view that those who committed major sins will be brought out of Hell, and intercession will be made for them. A single major sin will not cancel out all of one’s good deeds, but it may cancel out some, according to most of Ahl as-Sunnah. Nothing cancels out all good deeds except disbelief (kufr), just as nothing cancels out all bad deeds except repentance. If the one who has committed major sin does good deeds, seeking thereby the pleasure of Allah, Allah will reward him for that even if he deserves punishment for his major sin.
End quote from Majmoo‘ al-Fataawa (10/321-322). 
Ibn al-Qayyim (may Allah have mercy on him) said:
Some people may mix a righteous deed with a bad deed, so they do both good deeds and major sins, and they meet Allah persisting in that and not having repented from it, but their good deeds outweigh their bad deeds. So when their deeds are weighed, and the good deeds weigh more heavily, they will also be saved and be successful. Allah, may He be exalted, says (interpretation of the meaning):
“And the weighing on that day (Day of Resurrection) will be the true (weighing). So as for those whose scale (of good deeds) will be heavy, they will be the successful (by entering Paradise).
And as for those whose scale will be light, they are those who will lose their ownselves (by entering Hell) because they denied and rejected Our Ayat (proofs, evidences, verses, lessons, signs, revelations, etc)” [al-A‘raaf 7:8-9]. 
Hudhayfah, ‘Abdullah ibn Mas‘ood and others among the Sahaabah said: On the Day of Resurrection, the people will be gathered in three categories. Those whose good deeds outweigh their bad deeds, even by one, will enter Paradise. Those whose bad deeds outweigh their good deeds, even by one, will enter Hell. And those whose good deeds and bad deeds are equal will be among the people of the Heights (al-A‘raaf, between Paradise and Hell). 
This weighing up of good and bad deeds will come after scores have been settled and those who were wronged have had their rights restored by taking from the good deeds of those who wronged them. Then if any of their good deeds are left, they will be weighed, as will their bad deeds. Tareeq al-Hijratayn (1/562) 
Fourthly: 
This does not mean that one whose bad deeds outweigh his good deeds by one will enter Hell; rather he deserves punishment for his deeds, yet despite that he is also subject to the will of Allah, may He be exalted, as is the principle of Ahl as-Sunnah with regard to those who commit major sins: if Allah wills He will forgive him and if He wills He will punish him. 
Shaykh Haafiz al-Hakami (may Allah have mercy on him) said: 
Question: how can we reconcile between the words of the Prophet (blessings and peace of Allah be upon him) in this hadith, “… Then he case rests with Allah; if He wills He will forgive him and if He wills He will punish him” (agreed upon), and what was mentioned previously, that the one whose bad deeds outweigh his good deeds will enter Hell?
Answer: there is no contradiction between them. For the one whom Allah wants to forgive, He will give him an easy reckoning which the Prophet (blessings and peace of Allah be upon him) described in the following terms: “One of you will be brought near to his Lord, may He be glorified and exalted, until He places His concealment over him, and will say: ‘You did such and such’ and he will say, ‘Yes,’ and He  will say: ‘You did such and such’ and he will say, ‘Yes,’ and will make him admit it, then He will say: ‘I concealed you in the (former) world, and I have forgiven you for it this Day.’” (Agrees upon). 
As for those who will enter the Fire for their sins, they are among those for whom the reckoning will be examined thoroughly. The Prophet (blessings and peace of Allah be upon him) said: “Whoever is given a thorough reckoning will be punished.” (Agreed upon). End quote.  A‘laam as-Sunnah al-Manshoorah (171) 
And Allah knows best. 
For more information, please see the answers to questions no. 98964 , 107241 and 112113 .