It is reported that Al-Ḥasan Al-Baṣrī – Allāh have mercy on him – said:

It has reached me that when Allāh the Mighty and Majestic blesses a people and gives them some good he asks them to be grateful. If they are grateful, He is all-able to give them more. But if they are ungrateful, He is all-able to turn His blessings into a punishment.

Al-Bayhaqī, Shu’ab Al-Imān article 4536.