Al-A'raf - 7:168

وَقَطَّعْنَاهُمْ فِي الأَرْضِ أُمَمًا مِّنْهُمُ الصَّالِحُونَ وَمِنْهُمْ دُونَ ذَلِكَ وَبَلَوْنَاهُمْ بِالْحَسَنَاتِ وَالسَّيِّئَاتِ لَعَلَّهُمْ يَرْجِعُونَ
[7:168]
And We cut them up on the earth into parties, (some) of them being righteous and (others) of them falling short of that, and We tried them with blessings and misfortunes that they might turn.
We broke them up into sections on this earth. There are among them some that are the righteous, and some that are the opposite. We have tried them with both prosperity and adversity: In order that they might turn (to us).
And We have sundered them in the earth as (separate) nations. Some of them are righteous, and some far from that. And We have tried them with good things and evil things that haply they might return.