Immediately upon hearing that God was about to destroy Sodom and Gomorrah, Avraham Avinu began to pray on their behalf. He claimed that if there were a core group of righteous people (tzaddikim) in Sodom, who were willing to work hard to spread their beliefs, then there was a chance that the tzaddikim would succeed in countering the pernicious influence of the wicked, and cause the residents of the region to repent. In this way, Sodom and Gomorrah would be uplifted without having to be destroyed. However, after he learned that there were not even ten tzaddikim in the place, he ceased praying for them (Genesis 18).

It is interesting to note exactly what Avraham claimed. “Perhaps there are fifty tzaddikim within the city; will You also destroy and not save the place for the fifty tzaddikim inside it?” (Genesis 18:24). And God answers: “If I find in Sodom fifty tzaddikim within the city, I will spare the entire area for their sake” (Genesis 18:26). The Ibn Ezra explains, “The importance of their being within the city is that then, their reverence of God will be seen by all,” and subsequently there is a chance that the wicked will be moved to mend their ways. However, if the tzaddikim display their righteousness only within their homes, and are only concerned with their own spiritual elevation, there is no possibility of influencing the public to rectify their deeds. And to a certain extent, their influence is liable to have a reverse effect, for if they live alongside a community that is immersed in transgression, and do not make an effort to protest the wickedness, they are seemingly lending support to the immoral norms of the place. For the evildoers can then say to themselves, “Behold, these tzaddikim are living among us, and they don’t say a word to us about our deeds. It must be that our behavior is perfectly fine.”

It may very well be that according to the Ibn Ezra, there were ten “private” tzaddikim within the city, who did not join the others in sin, but who kept their righteousness to themselves, and did not protest against the actions in the city. They saw that orphans and poor people were being exploited, and kept silent. They heard the screams of a righteous young woman who was cruelly murdered for having given food to a beggar, and yet, they remained mute. Therefore, they were punished along with the wicked.
Only Lot was saved, owing to his connection to Avraham. When guests arrived at his home, he invited them in, just as he had learned from Avrham Avinu – thus rescuing them from the nefarious intentions of the residents of Sodom. His act was a brave expression of protest against the Sodomites, and in the merit of this, he was saved from the fate of the city.

The Ibn Ezra further explains that during the days of the First Temple, there were also “private” tzaddikim in Jerusalem who did not protest against the deeds of the wicked. Therefore Jerusalem was not spared for their sake, as it says, “Run to and fro through the streets of Jerusalem, and see now, and know, and seek in its broad places, if you can find a man, if there be any who does justice, who seeks the truth; and I will pardon it” (Yirmeyahu 5:1). However, there was no one in the public places who sought truth and justice – and because of this, Jerusalem was destroyed.

The brave tzaddikim who are not embarrassed to stand up for their beliefs and battle against wickedness, possess enormous power to stand before God and beseech Him to judge Am Yisrael in a favorable light. Such Tzaddikim do not back down out of weakness or fear in their demand for truth and justice. On the contrary, their entire lives are dedicated to revealing Divine goodness in the world. Therefore, when they speak out in the merit of the Jewish People, their words are accepted.

(See the article by Rabbi Yosef Dov Solevechik, “Kol Dodee Dofek,” pg.72, where he explains that Job’s sufferings stemmed in large measure from the fact that although he was righteous in his personal life, he did not exert himself to aid the community around him, and to protest against injustices that he had witnessed, as when he was an adviser to Pharaoh and kept silent during the oppression of the Jews, fearing he would be accused of harboring dual loyalties).