A man said, "O Messenger of Allah ﷺ! Shall we be punished for what we did in the Prelslamic Period of ignorance?" The Prophet ﷺ said, "Whoever does good in Islam will not be punished for what he did in the Pre-lslamic Period of ignorance and whoever does evil in Islam will be punished for his former and later (bad deeds). (Using translation from Bukhārī 6921)
رَجُلٌ لِلنَّبِيِّ ﷺ أَيُؤَاخَذُ أَحَدُنَا بِمَا عَمِلَ فِي الْجَاهِلِيَّةِ؟ قَالَ مَنْ أَحْسَنَ فِي الْإِسْلَامِ لَمْ يُؤَاخَذْبِمَا عَمِلَ فِي الْجَاهِلِيَّةِ وَمَنْ أَسَاءَ فِي الْإِسْلَامِ أُخِذَ بِالْأَوَّلِ وَالْآخِرِ