Sure Al-A'raaf

7:168

وَقَطَّعْنَٰهُمْ فِى ٱلْأَرْضِ أُمَمًۭا ۖ مِّنْهُمُ ٱلصَّٰلِحُونَ وَمِنْهُمْ دُونَ ذَٰلِكَ ۖ وَبَلَوْنَٰهُم بِٱلْحَسَنَٰتِ وَٱلسَّيِّـَٔاتِ لَعَلَّهُمْ يَرْجِعُونَ

Und Wir zerteilten sie auf der Erde in Gemeinschaften. Unter ihnen gab es Rechtschaffene und solche, die dies nicht waren. Und Wir prüften sie mit Gutem und Bösem, auf daß sie umkehren mögen.

Tafsir 7:168

And I broke and separated them up in the earth, dividing them into communities, after they had been united. Among them were those who were righteous and who upheld the rights of Allah and the rights of His creatures; among them were those who were moderate; and among them were those who were excessive in their disobedience. Allah tested them with ease and difficulty, so that they might return from what they were doing.