A city could be saved by following the seven laws of Noah.
In this week’s Parsha Vayeira, we learn about the inhabitants of Sodom and its neighbors who were destroyed because they became very wicked. The Torah states that they were “wicked and sinful against G-d, very much”. However, the wickedness of Sodom and its neighbors was a misguided overreaction to Noah’s flood. The flood generation was wiped out mainly because they practiced and allowed themselves robbery – taking one person’s property by force. The residents of Sodom, who were aware of this, declared absolute private property rights, meaning outlawing charity and hospitality. They saw charity and hospitality as unjust use of another person’s property meaning they took the sin of the flood generation to the extreme to the exact opposite. Total non-use of another person’s property. From this arose their wickedness against charity, kindness, and hospitality.
In their zeal, the people of Sodom did not realize that this reverse extremism was just as destructive as robbery. Therefore, since the world cannot fulfill its purpose of being G-d’s true home without acts of kindness, they acted against the Divine intention. Therefore it was necessary to eliminate Sodom and its neighbors, just like the generation of the flood. Nevertheless, since their intentions, however, were motivated by a desire to do the right thing, the Torah says that these cities will be restored in the Messianic era. It means that when Moshiach is revealed very soon, the cities of Sodom and Gomorrah will also return to being settled!
The connection between Sodom and Gomorrah and the 7 laws of Noah is that these laws are universal moral principles that apply to all human beings. One of these laws is establishing courts and ensuring justice in our world. With every small act of justice, we restore harmony to the world, therefore we must keep the laws of the 7 commandments of the sons of Noah because they maintain the existence of society. On the other hand, a city that acts to the extreme against the laws of 7 Noah’s sons (as seen in the city of Gaza) may find itself in an outcome similar to that of Sodom and Gomorrah.
*This is from a series of articles by Rabbi Bernstein Moshe.