Chazal
Chazalתָּנוּ רַבָּנַן: בָּרָאתִי יֵצֶר הָרָע וּבָרָאתִי לוֹ תּוֹרָה תַּבְלִין, וְאִם אַתֶּם עוֹסְקִים בַּתּוֹרָה אֵין אַתֶּם נִמְסָרִים בְּיָדוֹ, שֶׁנֶּאֱמַר הֲלֹא אִם תֵּיטִיב שְׂאֵת, וְאִם לֹא תֵּיטִיב לַפֶּתַח חַטָּאת רֹבֵץ, וְלֹא עוֹד אֶלָּא שֶׁכָּל מַשָּׂאוֹ וּמַתָּנוֹ בְּךָ, שֶׁנֶּאֱמַר וְאֵלֶיךָ תְּשׁוּקָתוֹ, וְאִם אַתָּה רוֹצֶה אַתָּה מוֹשֵׁל בּוֹ, שֶׁנֶּאֱמַר וְאַתָּה תִּמְשָׁל בּוֹ.
The Sages taught: I created the evil inclination and I created Torah as its remedy. If you engage in Torah you will not be delivered into its hand, as it is said “If you do well, there is uplift”; if you do not, “sin crouches at the door.” Moreover, all its dealings are with you, as it is said “and its desire is toward you”; and if you wish, you can rule over it, as it is said “and you shall rule over it.”