After the Flood, Noach emerged from the Ark and offered sacrifices to Hashem, Who then made a covenant with him, never again to destroy the world:
וירח ה' את ריח הניחח ויאמר ה' אל לבו לא אסף לקלל עוד את האדמה בעבור האדם כי יצר לב האדם רע מנעריו ולא אסף עוד להכות את כל חי כאשר עשיתי.
Hashem smelled the fragrant offering, and Hashem said to Himself, “I will never again strike the earth for the sake of man, since the heart of man is wicked from his youth. I will never again strike every living thing as I have done.”
Here it seems that Hashem’s recognition that “the heart of man is wicked” is a plea in our defense, as if to say that we are not entirely responsible for our misdeeds, since we are prey to our evil inclinations. However, an apparent contradiction is found in the passage that precedes the Flood, in which the very same argument is used against us:
וירא ה' כי רבה רעת האדם בארץ וכל יצר מחשבת לבו רק רע כל היום. וינחם ה' כי עשה את האדם בארץ ויתעצב אל לבו. ויאמר ה' אמחה את האדם אשר בראתי מעל פני האדמה מאדם עד בהמה עד רמש ועד עוף השמים כי נחמתי כי עשיתם.
Hashem saw that the wickedness of man was great upon the earth, and the entire inclination of his heart was only for evil the entire day. Hashem regretted having made man upon the earth, and His heart was upset. Hashem said, “I will wipe this man that I have created off the face of the earth, from man to beast, to crawling insect, to the birds of heaven, for I regret having created them.”
Here it seems that for this same reason, that the heart of man is inclined towards wickedness, Hashem decided to destroy the world. How could this very same reason be His basis for vowing to never again destroy it?
It seems that a subtle distinction must be drawn between the two pesukim. Before the Flood, Hashem said that man’s entire inclination was only for evil for the entire day. Man had no thoughts other than how to indulge his pleasures at the expense of others. After the Flood, the possuk states only that man’s heart is wicked from his youth. It does not state that he is always or entirely wicked. Man continued to have wicked thoughts, but he was no longer entirely wicked. Therefore, Hashem swore to spare mankind from annihilation.
The difference between the condition of the human race before the Flood, and our condition after the Flood, was that before the Flood there was no Torah. The Midrash Tanchuma states that had Adam observed the Torah, he would never have died. From that time until the Flood, the world continued to exist in a dark abyss, devoid of the light of Torah.
After the Flood, however, Noach built a new world based on the foundation of Torah study. He himself studied Torah, and was therefore able to discern which animals were kosher, and allow seven pairs of each into the Ark. His son, Shem, established a house of study, from which Rivka Immeinu inquired the fate of her unborn children.
Hashem, Who created the yetzer hara, informed us of its only remedy – “I created the yetzer hara, and I created the Torah as its antidote.” In a world where Torah flourishes, there is still a yetzer hara, and man’s heart still wanders to thoughts of wickedness from time to time, but it is no longer true that “man’s entire inclination is only for evil for the entire day.” Since Torah helps to subjugate man’s evil inclination, it is the merit of Torah that preserves the world.
This thought is expressed in the Zohar, which states that as long as Torah exists in the world, and mankind labors in its study, HaKadosh Baruch Hu rejoices in His creation, and His joy permeates throughout all the worlds. The heavens and earth are supported in this merit.
Although man continues to have a natural inclination towards evil, the Torah has the power to subdue this inclination and redirect it towards good. The Gemara states:
אמר רבי אלכסנדרי כל העוסק בתורה לשמה משים שלום בפמליא של מעלה ובפמליא של מטה שנאמר "או יחזק במעזי יעשה שלום לי שלום יעשה לי." רב אמר כאילו בנה פלטרין של מעלה ושל מטה שנאמר "ואשם דברי בפיך ובצל ידי כסיתיך לנטע שמים וליסד ארץ." רבי יוחנן אמר אף מגין על כל העולם כולו שנאמר "ובצל ידי כסיתיך." ולוי אמר אף מקרב את הגאולה שנאמר "ולאמר לציון עמי אתה."
Rebbe Alexanderi said: Anyone who toils in Torah for its own sake, brings peace to the Court of Heaven and to the Court of Earth, as the possuk states, “If he grasps hold of My mighty Torah, he will make peace for Me. Peace, he will make for Me.”
Rav said: It is as if he builds the palaces of Heaven and Earth, as the possuk states, “I will place My word in your mouth, and cover you with the shade of My hand, to stretch out the Heavens, and establish the earth.”
Rebbe Yochanan said: He also protects the entire world, as the possuk states, “And I will cover you with the shade of My hand.”
Levi said: He even hastens the Redemption, as the possuk continues, “And to say unto Zion, ‘You are My nation.’”
From here we learn that in the merit of immersing ourselves in the wisdom of the Torah, we support the entire world, ensure its preservation, rectify it with the Kingdom of Heaven, and hasten the ultimate Redemption, may it be soon and in our times.
 Bereishis 8:21
 Bereishis 6:5-7
 Beginning of Parshas Bechukosai
 Rashi, Bereishis 7:2
 Bereishis 25:22, Rashi
 Kiddushin 30b
 Parshas Teruma
 Sanhedrin 99b
 Yeshaya 27:5
 Yeshaya 51:16