Ibn Shumasah narrates that we came to visit Sayyiduna Amr bin Al-As (may Allah be pleased with him) (to tend to him) while he was in the throes of death. He wept for a long time, then said: When Allah Almighty placed the love of Islam in my heart, I presented myself before the Prophet Muhammad (peace and blessings be upon him). I said: O Messenger of Allah, extend your right blessed hand so that I may pledge allegiance to you. So the Prophet (peace be upon him) extended his hand. I withdrew my hand. The Prophet (peace be upon him) said: “O Amr, what is the matter with you? (Why did you withdraw your hand?)” Sayyiduna Amr (may Allah be pleased with him) says: I said that I want to set a condition. The Prophet (peace be upon him) asked: “What condition do you want to set?” He said: That my past sins will be forgiven if I accept Islam? The Prophet (peace be upon him) said: “O Amr, do you not know that Islam wipes out previous sins, and migration (hijrah) also erases previous sins, and Hajj also becomes a cause for the forgiveness of past sins.”
Hadith Referenceصحيح ابن خزيمه / كتاب: المناسك / 2515