And if only the people of the cities had believed and feared Allāh, We would have opened [i.e., bestowed] upon them blessings from the heaven and the earth; but they denied [the messengers], so We seized them for what they were earning.1
If the people of the towns and cities which Allah sent His messengers to had believed in what their messengers brought them, and had been mindful of their Lord, leaving their disbelief and disobedience and following His commands, then Allah would have opened the doors of goodness upon them in every way; but they did not believe and were not mindful of Him. Instead they rejected what their prophets came with. So Allah overtook them with the punishment suddenly because of what they had earned through their sins and disobedience.