In his introduction to Avot, Rambam devotes a chapter to free will as the metaphysical foundation of teshuvah: without freedom of choice, repentance would be meaningless. This connects teshuvah to the broader philosophical framework of the soul.
ואמנם עניין זה שביארוהו חכמים, שהציות והמרי אינם לא בגזרתו יתברך ולא בחפצו, כי אם ברצון האיש, נמשכו בו אחר דברי ירמיה, והוא אמרו: "מפי עליון לא תצא הרעות והטוב" (איכה ג, לח) – כלומר, אין האלוהים גוזר על האדם שיעשה הרעות, ולא שיעשה הטובות. וכיון שכן הוא, ראוי לו לאדם לבכות ולקונן על חטאיו לאחר שפשע בבחירתו. הוא שכתוב אחריו: "מה יתאונן אדם חי, גבר על חטאיו" (איכה ג, לט). וחזר ואמר שרפוי חולי זה בידינו הוא. כי כשם שמריינו בבחירתנו, כך עלינו לחזור בתשובה ולעזוב רשענו. הוא שכתוב אחריו: "נחפשה דרכינו ונחקורה ונשובה עד ה'. נשא לבבנו אל כפים, אל אל בשמים" (איכה ג', מ'–מ"א). ולא עשינו דברינו פלסתר, באומרנו, שהאלוהים אפשר שמעניש אדם שלא יחזור בתשובה ואינו נותן לו בחירה בתשובה. שכן יתברך שמו יודע החטאים, וחכמתו ויושרו מחייבים שיעור העונש. ויש שמעניש בעולם הזה לבד, ויש שמעניש לעולם הבא לבד, ויש שמעניש בשני העולמות יחד. ועונשו בעולם הזה שונה הוא: יש שמעניש בגוף, או בממון, או בשניהם יחד. וכשם שהוא משבית כמה מתנועות האדם הבחיריות בדרך העונש, כגון שמשבית את ידו מן האחיזה, כמו שעשה לירבעם, או – עיניו מן הראיה, כמו שעשה לאנשי סדום הנקהלים על לוט; כך משבית הוא את בחירת התשובה שבו, עד שלא תתעורר בלבו כלל, ויאבד בחטאו. ולא עלינו לדעת חכמתו, עד שנבין לשם מה העניש באופן של עונש זה ולא העניש באופן אחר. כשם שאין אנו יודעים מה הסיבה הקובעת שתהא לסוג זה צורה זו, ולא תהא לו צורה אחרת. כללו של דבר: "כי כל דרכיו משפט" וגו' (דברים לב, ד), ומעניש החוטא לפי שעור חטאו, וגומל למיטיב לפי שעור הטבתו. ואם תאמר: "לשם מה דרש ממנו שלוח ישראל כמה פעמים, והוא משולל מזה כדי שתבאנה עליו המכות בעמדו בעיקשותו כמו שאמרנו: שנענש לעמוד בעיקשותו? ולא ידרוש ממנו חנם דבר שאי אפשר לו לעשותו?!" הרי שהיה גם זה בחכמה מעם האלוהים יתברך, שיודיעהו על אודות בחירתו: לכשירצה האלוהים לבטלה, הרי היא מבטלה. ואמר לו: "הריני דורש ממך שילוחם. ואם אתה משלחם עתה, ניצלת; אלא שאין אתה משלחם עד שתאבד". והיה פרעה צריך שייטיב, עד שיראה ההפך לתוכחת הנביא שנבצר ממנו להיטיב, ולא היה יכול, והיה בזה אות גדול ומפורסם בכל העולם, כמו שאמר: "ולמען ספר שמי בכל הארץ" (שמות ט, טז). יש שהאלוהים מעניש האדם בזה שימנעהו מבחירת פועל מה. ויודע הוא זאת ואינו יכול למשוך נפשו ולהשיבה אל אותה בחירה. ובאותו באופן ממש היה עונשו של סיחון מלך חשבון, שכן על מריו לשעבר, שלא הייתה כפייה בו, הענישו האלוהים בזה שמנעו מעשות רצון ישראל, עד שהרגוהו. והוא אמרו: "ולא אבה סיחון מלך חשבון העברנו בו, כי הקשה ה' אלוהיך את רוחו ואימץ את לבבו" וגו' (דברים ב, ל). ונתקשו בזה כל המפרשים, הואיל וחשבו שסיחון נענש על שלא הניח את ישראל עבור בארצו. ואמרו: "כיצד נענש והוא אנוס?" כמו שחשבו, שפרעה וסיעתו נענשו על שלא שלח את ישראל. ואין הדבר כן, אלא כמו שביארנו, שפרעה וסיעתו היה עונשם מעם האלוהים על חמסם לשעבר, שלא יחזרו בתשובה עד שתבואנה עליהם כל אותן המכות. והיה עונשו של סיחון על חמסו לשעבר, והעוול שעשה במלכותו, שימנע מעשות רצון ישראל, עד שיהרגוהו.
In making this assertion that obedience or disobedience to the Law of God does not depend upon the power or will of God, but solely upon that of man himself, the sages followed the dictum of Jeremiah, who said, "Out of the mouth of God there cometh neither the bad nor the good". By the words "the bad" he meant vice, and by "the good", virtue; and, accordingly, he maintains that God does not preordain that any man should be vicious or virtuous. Since this is so, it behooves man to mourn and weep over the sins and the transgressions he has committed, as he has sinned of his own free will in accordance with what the prophet says, "Wherefore should a living man mourn? Let every man mourn because of his sins". He continues, then, to tell us that the remedy for this disease is in our own hands, for, as our misdeeds were the result of our own free will, we have, likewise, the power to repent of our evil deeds, and so he goes on to say, "Let us search through and investigate our ways, and let us return to the Lord. Let us lift up our heart with our hands to God, in the heavens". No one can find fault with us when we say that God at times punishes man by withholding repentance from him, thus not allowing him free will as regards repentance, for God (blessed be He) knows the sinners, and His wisdom and equity mete out their punishment. Sometimes, He punishes only in this world, sometimes only in the world to come, sometimes in both. Furthermore, His punishment in this world is varied, sometimes being bodily, sometimes pecuniary, and sometimes both at once. Just as some of man's undertakings, which ordinarily are subject to his own free will, are frustrated by way of punishment, as for instance a man's hand being prevented from working so that he can do nothing with it, as was the case of Jeroboam, the son of Nebat, or a man's eyes from seeing, as happened to the Sodomites who had assembled about Lot, likewise does God withhold man's ability to use his free will in regard to repentance, so that it never at all occurs to him to repent, and he thus finally perishes in his wickedness. It is not necessary for us to know about God's wisdom so as to be able to ascertain why He inflicts precisely such punishment as He does and no other, just as little as we know why one species has a certain particular form and not another. It is sufficient for us to know the general principle, that God is righteous in all His ways, that He punishes the sinner according to his sin, and rewards the pious according to his righteousness. If you should inquire why God repeatedly asked Pharaoh to release Israel which he was unable to do—while he, in spite of the plagues which befell him, persisted in his rebellion and stubbornness, which very rebelliousness and stubbornness was his punishment—and yet God would not in vain have asked him to do a thing which he could not do, then know that, this, too, was a part of God's wisdom, to teach Pharaoh that God can suspend man's freedom of will when it pleases Him to do so. So, God said to him (through Moses), "I desire that thou shouldst liberate them, but thou wilt not dismiss them, so that thou shouldst die". Pharaoh should have consented to release them, and therely disprove the words of the prophet (Moses) that he was unable to obey, but he had not the power. Thus, a great wonder was revealed to the people, as it is said, "In order that they may proclaim my name throughout the earth", namely, that it is possible for God to punish man by depriving him of his free will respecting a certain deed, while he, though realizing it, is, however, unable to influence his soul, and return to his former state of freedom of the will. Such was, likewise, the punishment of Sihon, King of Heshbon; for, on account of his former misdeed, to which he was not forced, God punished him by preventing him from granting the request of the Israelites, as a result of which they put him do death, as Scripture says, "But Sihon, the king of Heshbon, would not suffer our passing by him", etc. What has made this passage difficult for all commentators is their impression that Sihon was punished for not permitting Israel to pass through his land, just as they imagined that Pharaoh and his adherents were punished for not releasing Israel, and so they ask, "How could he (Sihon) be justly punished, since he was not a free agent?" These suppositions are incorrect, and the matter is as we have explained, namely, that Pharaoh and his adherents were punished by God because of their previous oppression of Israel, of which they did not repent, so that there befell them all the plagues; while Sihon's punishment, which consisted of his inability to do the will of Israel, thus resulting in his death, was due to the former deeds of oppression and injustice which he had practised in his kingdom.