Abdullah bin Masud reported,

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

Azami 12380

Sahih

عن ابن مسعود قال

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

الأعظمي 12380صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Tafsir of the great Quran
Chapter
Virtues of Surah Baqarah
Section
His saying, "Say to those who disbelieve, if they cease, what has passed will be forgiven for them, and if they return, then the precedent of the former peoples has already passed"
Numbering
Jami al-Kamil 12380 (2nd edition)
Azami 12380