Imaam Ibnul Qayyim (rahimahullaah) said:
Firstly: Sin and disobedience is something common in all the nations. It is something that has not cease to exist in the world amongst the Children of Aadam regardless of their different social classes; (be it) the common people, the ignorant ones, those who abstain from the worldly things and those desirous of it, the leaders and those under their rule. This affair of (sin and disobedience) is not something specific to this Ummah of Muhammad, such that (the ummah) and its Prophet are censured as a result of that.
Sin and disobedience does not negate belief in the Messengers, for it can be possible for sin and disobedience to exist alongside belief in the Messengers. And although disobedience diminishes the perfection and completeness of belief in the Messengers, however it does not negate it.
Secondly: Sins are wiped away through sincere repentance. Allaah forgives the slave when he turns repentant to Him (Glorified Be), even if his sins fill the heavens and are of a great number. Allaah said:
قُلۡ يَـٰعِبَادِىَ ٱلَّذِينَ أَسۡرَفُواْ عَلَىٰٓ أَنفُسِهِمۡ لَا تَقۡنَطُواْ مِن رَّحۡمَةِ ٱللَّهِۚ إِنَّ ٱللَّهَ يَغۡفِرُ ٱلذُّنُوبَ جَمِيعًاۚ إِنَّهُ ۥ هُوَ ٱلۡغَفُورُ ٱلرَّحِيمُ
”Say: “O ‘Ibaadee (My slaves) who have transgressed against themselves (by committing evil deeds and sins)! Despair not of the Mercy of Allaah, verily Allaah forgives all sins. Truly, He is Oft-Forgiving, Most Merciful’ [39:53]
This is the right of the one who repents because repentance wipes away the sin after it (was committed). Therefore, the one who repents from a sin is like one without that sin.
And Tawheed wipes away sins, as (mentioned) in the Hadeeth Al-Qudsiy: ‘O Son of Adam, if you were to meet Me with enough sins to fill the earth, then met Me, not associating anything with Me (in worship), I shall meet you with its equivalent in forgiveness.’
Therefore, strong Tawheed wipes away the sins of the Muslims; but if punished for their sins, they will be removed from the fire as a result of their belief in Tawheed.
As for the people of shirk and the disbelievers, their good deeds are nullified as result of the disbelief and shirk they are upon. They will neither meet their Lord with good deeds in order to obtain safety nor will they be forgiven any of their sins.
Allaah (Glorified Be He) said:
إِنَّ ٱللَّهَ لَا يَغۡفِرُ أَن يُشۡرَكَ بِهِۦ وَيَغۡفِرُ مَا دُونَ ذَٲلِكَ لِمَن يَشَآءُۚ
‘Verily, Allaah forgives not that partners should be set up with him in worship, but He forgives except that (anything else) to whom He pleases’ 4:48
Allaah (The Most High) said:
وَقَدِمۡنَآ إِلَىٰ مَا عَمِلُواْ مِنۡ عَمَلٍ۬ فَجَعَلۡنَـٰهُ هَبَآءً۬ مَّنثُورًا
‘And We shall turn to whatever deeds they did, and We shall make such deeds as scattered floating particles of dust.’ [25:23]
[Source: Hidaayatul Hayaaraa Fee Ajwibatil Yahood Wan-Nasaaraa’pg:123-124