Genesis 6–8 records the worldwide deluge, sent by God on account of man’s wickedness. The only survivors God chose were the righteous Noah, his wife, his three sons, and their wives.
He instructed Noah on building the ark, a huge wooden boat, to contain his family and pairs of all earth’s animals. God shut up the group in the ark and rain fell forty days and nights destroying all mankind except Noah’s family.
When Noah sent out a dove that returned with an olive branch, he knew the waters had receded enough to leave the ark.
Noah (at the age of 601) and his family left the ark, and Noah built an altar to God. God promised that never again would He destroy all living creatures. God established the rainbow as a reminder of this promise.
Skeptics doubt if the entire earth was ever flooded. However, the story crops up in various forms around the world.
The key lesson of the story is that God desires to preserve good people even when almost everyone is evil.