It is narrated from Sayyiduna Ibn Umar (may Allah be pleased with them both) that the Messenger of Allah (peace and blessings be upon him) said: When Allah inflicts punishment upon a people, that punishment befalls all the inhabitants (among whom both the righteous and the wicked are encompassed by it). Then Allah, the Exalted, will resurrect them according to their deeds. It is the same in the Book.