After Abraham interceded for the righteous still in Sodom, after the angelic visitors encountered all the deviant and violent people of Sodom, and after Lot, his wife, and his daughters finally leave the city, God brings destruction. It is righteous. And it is just.