The spiritual condition of the people before the Flood and in Sodom and Gomorrah was great sexual perversion, violence and horrible wickedness.
Evil had reached a boiling point among the people that God, who is Holy and Righteous, had to judge and destroy it.