"And We have already destroyed generations before you"—meaning: those who were destroyed from the past generations—"when they wronged," meaning: when they associated partners with Allah, "and they were not to believe." He informs of His knowledge regarding them, "Thus do We recompense the criminal people," meaning: the polytheists.
﴿وَلَقَدْ أَهْلَكْنَا الْقُرُونَ مِنْ قَبْلِكُمْ﴾ يُرِيدُ: مَنْ أُهْلِكَ مِنَ الْقُرُونِ السالفة ﴿لما ظلمُوا﴾ لَمَّا أَشْرَكُوا ﴿وَمَا كَانُوا لِيُؤْمِنُوا﴾ أَخْبَرَ بِعِلْمِهِ فِيهِمْ ﴿كَذَلِكَ نَجْزِي الْقَوْم الْمُجْرمين﴾ الْمُشْركين.