When someone converts to Islam, God forgives all of his previous sins and evil deeds. A man called Amr came to the Prophet Muhammad, may the mercy and blessings of God be upon him, and said, "Give me your right hand so that I may give you my pledge of loyalty." The Prophet stretched out his right hand.
Amr withdrew his hand. The Prophet said: "What has happened to you, O Amr?" He replied, "I intend to lay down a condition." The Prophet asked: "What condition do you intend to put forward?" Amr said, "That God forgive my sins." The Prophet, may the mercy and blessings of God be upon him, said: "Didn’t you know that converting to Islam erases all previous sins?"
After converting to Islam, the person will be rewarded for his or her good and bad deeds according to the following saying of the Prophet Muhammad: "Your Lord, Who is blessed and exalted, is most merciful. If someone intends to do a good deed but does not do it, a good deed will be recorded for him. And if he does do it, (a reward of) ten to seven hundred or many more times (the reward of the good deed), will be recorded for him. And if someone intends to do a bad deed but does not do it, a good deed will be recorded for him. And if he does do it, a bad deed will be recorded against him or God will wipe it out."