Surah Al-Anfaal

8:53

ذَٰلِكَ بِأَنَّ ٱللَّهَ لَمْ يَكُ مُغَيِّرًۭا نِّعْمَةً أَنْعَمَهَا عَلَىٰ قَوْمٍ حَتَّىٰ يُغَيِّرُوا۟ مَا بِأَنفُسِهِمْ ۙ وَأَنَّ ٱللَّهَ سَمِيعٌ عَلِيمٌۭ

That is because Allah would not change a favor which He had bestowed upon a people until they change what is within themselves. And indeed, Allah is Hearing and Knowing.

Tafsir 8:53

That severe punishment is because when Allah favours a people, He does not take it away from them until they change themselves from their pure state of faith, righteousness and gratitude to a bad state of disbelief in Allah, sin and ingratitude – Allah hears the statements of His servants and knows about their actions; nothing is hidden from Him.