Abdullah bin Masud reported,

A man came to the Prophet ﷺ and said, "Messenger of Allah, if I do well in Islam, will I be held accountable for what I did in the time of ignorance?"He replied, "If you do well in Islam, you will not be held accountable for what you did in the time of ignorance. But if you do badly in Islam, you will be held accountable for both the former and the latter."

Ahmad 3596

Sahih

حدثنا أبو معاوية حدثنا الأعمش عن شقيق

عن عبد الله قال

أتى النبي ﷺ رجل فقال يا رسول الله إذا أحسنت في الإسلام أؤاخذ بما عملت في الجاهلية فقال إذا أحسنت في الإسلام لم تؤاخذ بما عملت في الجاهلية وإذا أسأت في الإسلام أخذت بالأول والآخر

أحمد 3596صحيح
Contents
Reference
Commentary
Ayat
Collection
Musnad Ahmad
Book
Abdullah bin Masud
Numbering
Darussalam 3596
Ahmad 3596