(Al-Ahraf) 7 : 165
فَلَمَّا نَسُوا مَا ذُكِّرُوا بِهِ أَنْجَيْنَا الَّذِينَ يَنْهَوْنَ عَنِ السُّوءِ وَأَخَذْنَا الَّذِينَ ظَلَمُوا بِعَذَابٍ بَئِيسٍ بِمَا كَانُوا يَفْسُقُونَ
Thus, when they forgot what they have been reminded of, We saved those who had forbidden the evils, and We seized those who were the wrongdoers with dreadful punishment because they were transgressing.
Among the three categories mentioned above, Lord saved the people of the third category who were the believers. The people of the second category who didn't forbid evil after Knowledge comes to them were punished grievously due to their transgression. See explanation 2: 62 and 7: 51.