وَتِلْكَ ٱلْقُرَىٰٓ أَهْلَكْنَـٰهُمْ لَمَّا ظَلَمُوا۟ وَجَعَلْنَا لِمَهْلِكِهِم مَّوْعِدًا Qur’an Al-Kahf (18:59)Watilka alqur a ahlakn a hum lamm a th alamoo wajaAAaln a limahlikihim mawAAid a n
Lit., "when [or "after"] they had been doing wrong" - i.e., persistently and for a long time.
i.e., the peoples of ’Ȃd and Thamûd.
The instances of exemplary Punishment in former times were also subject to this rule, that Allah gives plenty of rope to the wicked, in case they might turn, repent, and obtain His Mercy.