498. Good deeds committed earlier by non- Muslims turn into benefits.
Those who believe in Allah and the day of judgment, and also other beliefs in the rightway alone are guaranteed paradise in the hereafter is the fundamentals of Islam.
Those who do a lot of charity and all other charitable acts, but have not accepted Islam, stand to receive the benefits of these acts in this world itself. Since these good deeds by these people were not done with the creator in mind, the benefits will not be awarded by Him, and this person also cannot expect the same.
Similarly, a person who by birth happens to be a Muslim and equates creations of God with with Him, is deemed to have lost all the good deeds done by him. This can be understood from verses 6:88, 29:65 of the Quran. The good deeds done by a person before he accepted Islam as a way of life, would be treated by the Almighty as goodness committed by him in his credit.
Similarly, if a person who has already accepted Islam as a way of life and due to misunderstanding the religion, committed acts equating creations with the Creator, and on realization later accepts Monotheism would not stand to lose the benefits of the good acts committed by him during the period of ignorance he underwent. And in he same way if the people who had not fulfilled their duties correctly as a true Muslim, and turn towards the right path do not stand to lose the benefits of having been virtuous earlier. It can be seen from verses (29:7, 2:143, 25:70) of the Quran, the wrongful acts and beliefs committed by these people are treated as virtuous ones.