Abdullah bin Masud reported,

We asked, "Messenger of Allah, will we be held accountable for what we did during the days of ignorance?"He replied, "Whoever does well in Islam will not be held accountable for what he did during the days of ignorance, but whoever does evil in Islam will be held accountable for both the former and the latter."

Muslim 319

Sahih

حدثنا محمد بن عبد الله بن نمير حدثنا أبي ووكيع ح و حدثنا أبو بكر بن أبي شيبة واللفظ له حدثنا وكيع عن الأعمش عن أبي وائل

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

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

مسلم 319صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Muslim
Book
Faith
Chapter
Whether one is held accountable for deeds of the pre-Islamic era
Numbering
Darussalam 319
Muslim 319