7:96
وَلَوْ أَنَّ أَهْلَ ٱلْقُرَىٰٓ ءَامَنُوا۟ وَٱتَّقَوْا۟ لَفَتَحْنَا عَلَيْهِم بَرَكَٰتٍۢ مِّنَ ٱلسَّمَآءِ وَٱلْأَرْضِ وَلَٰكِن كَذَّبُوا۟ فَأَخَذْنَٰهُم بِمَا كَانُوا۟ يَكْسِبُونَ
And if only the people of the cities had believed and feared Allah, We would have opened upon them blessings from the heaven and the earth; but they denied [the messengers], so We seized them for what they were earning."
Translation · Saheeh International
Tafsir
Ibn Kathīr (abridged)
Blessings come with Faith, while Kufr brings Torment
Allah mentions here the little faith of the people of the towns to whom He sent Messengers. In another instance, Allah said,
فَلَوْلاَ كَانَتْ قَرْيَةٌ ءَامَنَتْ فَنَفَعَهَآ إِيمَانُهَا إِلاَّ قَوْمَ يُونُسَ لَمَّآ ءَامَنُواْ كَشَفْنَا عَنْهُمْ عَذَابَ الخِزْىِ فِى الْحَيَوةَ الدُّنْيَا وَمَتَّعْنَاهُمْ إِلَى حِينٍ
(Was there any town (community) that believed (after seeing the punishment), and its faith (at that moment) saved it (from the punishment) -- Except the people of Yunus; when they believed, We removed from them the torment of disgrace in the life of the (present) world, and permitted them to enjoy for a while.) 10:98 This Ayah indicates that no city believed in its entirety, except the city of Prophet Yunus, for they all believed after they were stricken by punishment. Allah said (about Prophet Yunus),
وَأَرْسَلْنَـهُ إِلَى مِاْئَةِ أَلْفٍ أَوْ يَزِيدُونَ - فَـَامَنُواْ فَمَتَّعْنَـهُمْ إِلَى حِينٍ
(And We sent him to a hundred thousand (people) or even more. And they believed; so We gave them enjoyment for a while.) 37:147-148 Allah said in another Ayah,