Even to the experienced reader, the commandments given in the Book of Deuteronomy for the Israelites to destroy the Canaanite nations upon entry into the Land of Israel can appear wholly exterminationist without space for nuance or conditional limilations. And it is not at all difficult to find commentators that reinforce such a reading.
But such an understanding of this sugya shouldn't be seen as a universally held position (a "kulei alma," so to speak). And it might not even be the normative one. The commandment to destroy the "Seven Nations" that dwelt in Canaan is understood by standard sources in Chazal and Rishonim to have significant caveats attached to them, as we shall see. These caveats will not bring this sugya completely in alignment with modern sensibilities. But, for many readers, I suspect they will narrow the cognitive gap significantly.
The key Machlokes Rishonim here is the Ramban (and Rambam) vs. Rashi in Deuteronomy 20:10.
Before we get there, though, let's take a look at Deut. 7:1-2. These pesukim introduce us to the topic of eliminating the "Seven Nations", and by itself, it looks pretty black and white:
(א) כִּ֤י יְבִֽיאֲךָ֙ יְהֹוָ֣ה אֱלֹהֶ֔יךָ אֶל־הָאָ֕רֶץ אֲשֶׁר־אַתָּ֥ה בָא־שָׁ֖מָּה לְרִשְׁתָּ֑הּ וְנָשַׁ֣ל גּֽוֹיִם־רַבִּ֣ים ׀ מִפָּנֶ֡יךָ הַֽחִתִּי֩ וְהַגִּרְגָּשִׁ֨י וְהָאֱמֹרִ֜י וְהַכְּנַעֲנִ֣י וְהַפְּרִזִּ֗י וְהַֽחִוִּי֙ וְהַיְבוּסִ֔י שִׁבְעָ֣ה גוֹיִ֔ם רַבִּ֥ים וַעֲצוּמִ֖ים מִמֶּֽךָּ׃ (ב) וּנְתָנָ֞ם יְהֹוָ֧ה אֱלֹהֶ֛יךָ לְפָנֶ֖יךָ וְהִכִּיתָ֑ם הַחֲרֵ֤ם תַּחֲרִים֙ אֹתָ֔ם לֹא־תִכְרֹ֥ת לָהֶ֛ם בְּרִ֖ית וְלֹ֥א תְחׇנֵּֽם׃
(1) When your God יהוה brings you to the land that you are about to enter and possess, and [God] dislodges many nations before you—the Hittites, Girgashites, Amorites, Canaanites, Perizzites, Hivites, and Jebusites, seven nations much larger than you— (2) and your God יהוה delivers them to you and you defeat them, you must doom them to destruction: grant them no terms and give them no quarter.
The way the commandment within this pasuk is explicated in the Sefer HaChinuch, shown below, gives no hint of there being any halachic mechanism through which the Seven Nations might end up staying alive other than through a failure on the part the Israelites to carry out the commandment. (Even though only the beginning portion of the Sefer HaChinuch's commentary is presented here, it is representative of the rest.)
However, things get complicated when you get to Deut. 20:10-17, which opens with the command to sue for peace when attacking a city, and then introduces a distinction between when one is attacking cities outside of the Land of Israel and those within.
The question is, what is the nature of this distinction? This is the disagreement between Rashi and Ramban:
WHEN THOU DRAWEST NEAR UNTO A CITY TO FIGHT AGAINST IT, THEN PROCLAIM PEACE UNTO IT. “Scripture is speaking of a permissible war [rather than a war required by the Torah, such as the invasion of the seven nations of Canaan], as it is expressly stated in this section, Thus shalt thou do unto all the cities which are very far off from thee.” This is Rashi’s language. The Rabbi [Rashi] wrote this based on the Sifre where a similar text is taught: “Scripture is speaking of a battle waged of free choice.” But the intent of our Rabbis with reference to this verse [before us, was not to say that the requirement of proclaiming peace applies exclusively to permissible, but not to obligatory, wars; rather, their teaching in the Sifre] refers only to the later section wherein there is a differentiation between the two kinds of wars [i.e., in Verses 13-14 declaring that if the enemy insists on war, then only the men are to be killed, but the women and children are to be spared — that law applies only to a permissible but not to an obligatory war]. But the call for peace applies even to an obligatory war. It requires us to offer peace-terms even to the seven nations [of Canaan], for Moses proclaimed peace to Sihon, king of the Amorites, and he would not have transgressed both the positive and negative commandments in this section: but thou shalt utterly destroy them, and thou shalt save alive nothing that breatheth! Rather, the difference between them [i.e., obligatory and permissible wars] is when the enemy does not make peace and continues to make war. Then, in the case of the cities which are very far off, Scripture commanded us to smite every male thereof and keep alive the women and male children, but in the cities of these peoples [i.e., the seven nations of Canaan in the event they refuse the call to peace], it commanded us to destroy even the women and children. And so did our Rabbis say in the Midrash of Eileh Hadevarim Rabbah, and it is found also in Tanchuma and in the Gemara Yerushalmi: “Rabbi Shmuel the son of Rabbi Nachmani said: Joshua the son of Nun fulfilled the laws of this section. What did Joshua do? Wherever he went to conquer, he would send a proclamation in which he wrote: ‘He who wishes to make peace let him come forward and make peace; he who wishes to leave, let him leave, and he who wishes to make war, let him make war.’ The Girgashite left. With the Gibeonites who made peace, Joshua made peace. The thirty-one kings who came to wage war — the Holy One, blessed be He, cast them down etc.” And so indeed Scripture states with reference to all cities [including those of the seven nations], There was not a city that made peace with the children of Israel, save the Hivites the inhabitants of Gibeon; they took all in battle. For it was of the Eternal to harden their hearts, to come against Israel in battle, that they might be utterly destroyed. Obviously, if they had wanted to make peace, the Israelites would have made peace with them.
It appears that regarding the terms of peace, there were differences [between what was offered the very far off cities and what was offered the seven nations], for, with reference to the distant cities, we ask that they make peace and become tributary to us and serve, but, regarding the cities of these peoples [the seven nations] we request of them peace, tribute and service, on the condition that they agree not to worship idols. Scripture does not mention it in this section, because concerning idolators, it has already given the prohibition, They shall not dwell in thy Land, lest they make thee sin against Me, for thou wilt serve their gods. It is possible that we must inform them only of the peace offer, tribute and service; after they are subject to us, we tell them that we execute judgment upon idols and their worshippers, whether individuals or the community. Similarly, that which is stated here, That they teach you not to do after all their abominations, and with reference to it the Rabbis said in the Sifre, “But if they repent [of their idol-worship] they are not to be killed” — this refers to the seven nations. The “repentance” is that they accept upon themselves the seven commandments in which “the sons of Noah” were commanded, but not that they must convert to become righteous proselytes.
Now, in Tractate Sotah the Rabbis have said that “they [i.e., the Israelites upon coming into the Land] inscribed the Torah upon stones in seventy languages and that, below, they wrote, That they teach you not to do. However, [we deduce,] if the peoples were to repent, the Israelites would accept them.” Rashi explained this text as follows: “[This verse was written upon the stones below] to inform the nations that dwelled outside the border of the Land of Israel that they [i.e., the Israelites] were not commanded to destroy [populations] except for those [the seven nations] that dwell within the borders in order that they [the Canaanites] should not teach them their perverted practices. But as to those who dwell outside [the boundaries] we tell them, ‘If you repent, we accept you.’ Those who dwell within the Land we do not accept because their repentance was due to fear.” This is the language of the Rabbi [Rashi]. But it is not correct, for it was with reference to the cities of these peoples, that the Eternal thy G-d giveth thee for an inheritance — it was of them that he said that they teach you not thus indicating that if they do repent [thereby negating the fear that they may teach you] they are not to be slain. Similarly He said of them, They shall not dwell in thy Land, lest they make thee sin against Me, for thou wilt serve their gods, which indicates that if they abandon their gods they are permitted to dwell there.
This is the project of Solomon concerning which it is written, And this is the account of the levy which King Solomon raised; to build the House of the Eternal, and his own house, and Millo, and the wall of Jerusalem etc. All the people that were left of the Amorites, the Hittites, the Perizzites, the Hivites, and the Jebusites, who were not of the children of Israel; even their children that were left after them in the Land, whom the children of Israel were not able utterly to destroy, of them did Solomon raise a levy of bondservants, unto this day. But of the children of Israel did Solomon make no bondservants. This project he did in accordance with the Law, for they accepted the observance of the seven commandments upon themselves. Now it is clear that since Solomon was able to draft them as his laborers, he had power over them and he could have destroyed them, except that it was permissible to let them live, as we have written.
(א) לשלח שלום לערים שצרים עליהן - שנצטוינו בהלחמנו בעיר אחת מצד הרשות שנרצה להלחם בה, וזו היא שנקראת מלחמת הרשות, שנבטיח אותם שלא נהרגם אם ישלימו עמנו ויהיו לנו לעבדים, כלומר מעלים מס למלכנו וכבושים תחת ידינו. ואם לא ישלימו עמנו על הענין הנזכר אנו מצוים להרג מהם כל זכר שבעיר ההיא שהגיע לפרקו ונקח לנו הטף והנשים וכל שללה, ועל זה כלו יאמרו זכרונם לברכה מלחמת הרשות. ואמרו בספרי (כאן) אם אמרו מקבלין אנו עלינו מסים ולא שעבוד, שעבוד ולא מסים אין שומעין להם עד שיקבלו עליהם זו וזו.
(ב) משרשי המצוה. לפי שמדת הרחמנות היא מדה טובה וראוי לנו זרע הקדש להתנהג בה בכל עניננו גם עם האויבים עובדי עבודה זרה למעלתנו אנחנו, לא מצד היותם הם ראויים לרחמים וחסד, וגם כי יש בדבר הזה תועלת לנו להיות למלכנו עבדים יעבדוהו להעלות לו מס תמיד ולעשות מלאכותיו אם יצטרך מבלי שיוציא בהם הוצאה של כלום, ובהמיתנו אותם לא יהיה בדבר תועלת אחר שהם רוצים לעמד כבושים תחתינו, אבל יהיה בדבר השחתה והוראה עלינו במדת האכזריות, ויחסדנו שומע, ולהועיל על כל שזכרנו נצטוינו בזה.
(ג) מדיני המצוה. מה שאמרו זכרונם לברכה (רמב''ם מלכים פ''ו) שדין קריאת השלום הוא בכל מקום, כלומר בין במלחמת מצוה בין במלחמת רשות, ומלחמת מצוה היא כגון שבעה עממין ועמלק. והכל אם השלימו עמנו, כלומר שקבלו עליהם מס ועבדות, וכמו כן שקבלו עליהם שבע מצות אין הורגין מהם כל נשמה ויהיו למס ועבדונו, אבל כשלא השלימו יש חלוק בין מלחמת מצוה לרשות, שבמלחמת מצוה אין מחיין מהם כל נשמה, ובמלחמת הרשות מניחין מהם הטף והנשים, כמו שכתבנו בסמוך, וכן מניחין רוח אחת בעיר מצור במלחמת רשות שיברחו משם, וכדאיתא בספרי, וילפינן זה מדכתיב (במדבר לא, ז) ויצבאו על מדין כאשר צוה יי וגו' ובמלחמת שבעה עממין מקיפין אותם מכל צד, ומכל מקום מודיעים אותם תחלה שאם רצונם להניח העיר ושילכו להם הרשות בידם.
(1) To send peace to the cities that we besiege: That we were commanded in our fighting against a city by way of what is optional - that we want to fight against it, and that is what is called an optional war - that we assure them that we will not kill them if they make peace with us and become our servants; meaning to say that they raise a tax for our king and they be subdued under us. But if they do not make peace with us in the manner mentioned, we are commanded to kill all of their males in that city that have reached [maturity], and we take for ourselves the infants and the women and all of its booty. And about all of this, they, may their memory be blessed, said that it was an optional war. And they said in Sifrei Devarim 200, "If they said, 'We accept the taxes upon ourselves, but not the subjugation,' or 'subjugation, but not taxes' - we do not listen to them, until they accept this and that upon themselves."
(2) It is from the roots of the commandment [that it is] because the trait of mercy is a good trait and it is fitting for us - the holy seed - to practice in all of our matters. Even if the enemies are idolaters, it is for our stature - not from the angle of their being fit for mercy and kindness. And also because this thing has a benefit to us, that our king have servants that serve him and always raise him a tax, and do his work - if he needs - without his expending any expenses on them at all. And there is no benefit to us in our killing them, since they want to stay subdued under us; but rather there will be destruction in the thing and [in its] teaching us the trait of cruelty; and 'the one who hears [it] will revile us.' And we are commanded about this, to benefit us in all that we have mentioned.
(3) From the laws of the commandment are what they, may their memory be blessed, said (Mishneh Torah, Laws of Kings and Wars 6:1) that the law of the call for peace is with every place - meaning to say whether in a commanded war or in an optional war. And a commanded war is, for example, [against] the seven [Canaanite] nations and Amalek. And [with] all, if they make peace with us - meaning to say, they took upon themselves the tax and servitude, and likewise that they took upon themselves the seven commandments - we do not kill a soul from them, and they will be for tribute and serve us. But when they do not make peace, there is a distinction between a commanded war and an optional: That in a commanded war, we do not keep a soul alive; whereas in an optional war we keep their infants and women alive, as we wrote adjacently. And likewise, in an optional war, we leave one side of a besieged city open, that they can run away from there, and as it is found in Sifrei Bamidbar 157. And we learn this from that which is written (Numbers 31:7), "And they gathered upon Midian as the Lord commanded." But in a war against the seven nations, we encircle them from all sides. However, we nonetheless inform them first that if their will is to leave the city and go away, the option is in their hand.