"Far be it from you to do such a thing, to put the righteous to death with the wicked, so that the righteous fare as the wicked! Far be that from you! Shall not the Judge of all the earth do what is just?" (Genesis 18:25 ESV)
"In our pagan way, we take it for granted that God feels as we do. The idea that retribution might be the moral law of God's world and an expression of his holy character seems to us quite fantastic. Those who uphold it find themselves accused of projecting onto God their own pathological impulses of rage and vindictiveness. Yet the Bible insists throughout that this world which God in his goodness has made is a moral world, one in which retribution is as basic a fact as breathing.
"God is the Judge of all the earth, and he will do right, vindicating the innocent, if such there be, but punishing (in the Bible phrase visiting their sins upon) lawbreakers (see Gen 18:25). God is not true to himself unless he punishes sin. And unless one knows and feels the truth of this fact, that wrongdoers have no natural hope of anything from God but retributive judgment, one can never share the biblical faith in divine grace."
--J. I. Packer, Knowing God (InterVarsity Press, 1973, 1993) pp 130-31.
Painting above is "Destruction of Sodom and Gomorrah" by Henry Ossawa Tanner.