Laws of War
בד"א במלחמות הרשות אבל במלחמות מצוה הכל יוצאין אפילו חתן מחדרו וכלה מחופתה אמר רבי יהודה במה דברים אמורים במלחמות מצוה אבל במלחמות חובה הכל יוצאין אפי' חתן מחדרו וכלה מחופתה
The mishna adds: In what case are all of these statements, with regard to the various exemptions from war, said? They are said with regard to elective wars. But in wars whose mandate is a mitzva, everyone goes, even a groom from his room and a bride from her wedding canopy. Rabbi Yehuda said: In what case are all of these statements, with regard to the various exemptions from war, said? They are said with regard to wars whose mandate is a mitzva. But in obligatory wars, everyone goes, even a groom from his room and a bride from her wedding canopy.

(א) אֵין הַמֶּלֶךְ נִלְחָם תְּחִלָּה אֶלָּא מִלְחֶמֶת מִצְוָה. וְאֵי זוֹ הִיא מִלְחֶמֶת מִצְוָה זוֹ מִלְחֶמֶת שִׁבְעָה עֲמָמִים. וּמִלְחֶמֶת עֲמָלֵק. וְעֶזְרַת יִשְׂרָאֵל מִיַּד צָר שֶׁבָּא עֲלֵיהֶם. וְאַחַר כָּךְ נִלְחָם בְּמִלְחֶמֶת הָרְשׁוּת וְהִיא הַמִּלְחָמָה שֶׁנִּלְחָם עִם שְׁאָר הָעַמִּים כְּדֵי לְהַרְחִיב גְּבוּל יִשְׂרָאֵל וּלְהַרְבּוֹת בִּגְדֻלָּתוֹ וְשִׁמְעוֹ:

(ב) מִלְחֶמֶת מִצְוָה אֵינוֹ צָרִיךְ לִטּל בָּהּ רְשׁוּת בֵּית דִּין. אֶלָּא יוֹצֵא מֵעַצְמוֹ בְּכָל עֵת. וְכוֹפֶה הָעָם לָצֵאת. אֲבָל מִלְחֶמֶת הָרְשׁוּת אֵינוֹ מוֹצִיא הָעָם בָּהּ אֶלָּא עַל פִּי בֵּית דִּין שֶׁל שִׁבְעִים וְאֶחָד:

(1) A priori, the king does not go to fight other than a War of Mitzvoh (Mandatory War). What is a War of Mitzvoh? This is the war against the Seven Nations or the war against Amalek or a war to help Israel at the hands of a צָר who after them. After this, he may fight Discretionary Wars which are those wars he conducts against the other nations in order to enlarge the borders of Israel, and increase his renown and reputation. He does not need to obtain permission from the Court to engage in a War of Mitzvoh but he may, at any time, on his own, compel the people to go out to war. However, he requires the authorization of the Court of Seventy-One to take the people with him go out to fight a Discretionary War.

(ו) וַיֹּ֣אמֶר מֹשֶׁ֔ה לִבְנֵי־גָ֖ד וְלִבְנֵ֣י רְאוּבֵ֑ן הַאַֽחֵיכֶ֗ם יָבֹ֙אוּ֙ לַמִּלְחָמָ֔ה וְאַתֶּ֖ם תֵּ֥שְׁבוּ פֹֽה׃
(6) Moses replied to the Gadites and the Reubenites, “Are your brothers to go to war while you stay here?

ורבי יונתן בן שאול היא דתניא רבי יונתן בן שאול אומר רודף שהיה רודף אחר חבירו להורגו ויכול להצילו באחד מאבריו ולא הציל נהרג עליו

It is in accordance with the opinion of Rabbi Yonatan ben Shaul. As it is taught in a baraita: Rabbi Yonatan ben Shaul says: If a pursuer was pursuing another to kill him, and one was able to save the pursued party without killing the pursuer, but instead by injuring him in one of his limbs, but he did not save him in this manner and rather chose to kill him, he is executed on his account as a murderer.

(א) אִם־בַּמַּחְתֶּ֛רֶת יִמָּצֵ֥א הַגַּנָּ֖ב וְהֻכָּ֣ה וָמֵ֑ת אֵ֥ין ל֖וֹ דָּמִֽים׃
(1) If the thief is seized while tunneling, and he is beaten to death, there is no bloodguilt in his case.

מתני׳ הבא במחתרת נידון על שם סופו היה בא במחתרת ושבר את החבית אם יש

MISHNA: A burglar who is found breaking into a house may be killed by the owner of the house with impunity (see Exodus 22:1). He too is sentenced on account of his ultimate end,

(כד) וַיִּשְׁמְע֤וּ אֶל־חֲמוֹר֙ וְאֶל־שְׁכֶ֣ם בְּנ֔וֹ כָּל־יֹצְאֵ֖י שַׁ֣עַר עִיר֑וֹ וַיִּמֹּ֙לוּ֙ כָּל־זָכָ֔ר כָּל־יֹצְאֵ֖י שַׁ֥עַר עִירֽוֹ׃ (כה) וַיְהִי֩ בַיּ֨וֹם הַשְּׁלִישִׁ֜י בִּֽהְיוֹתָ֣ם כֹּֽאֲבִ֗ים וַיִּקְח֣וּ שְׁנֵֽי־בְנֵי־יַ֠עֲקֹב שִׁמְע֨וֹן וְלֵוִ֜י אֲחֵ֤י דִינָה֙ אִ֣ישׁ חַרְבּ֔וֹ וַיָּבֹ֥אוּ עַל־הָעִ֖יר בֶּ֑טַח וַיַּֽהַרְג֖וּ כָּל־זָכָֽר׃ (כו) וְאֶת־חֲמוֹר֙ וְאֶת־שְׁכֶ֣ם בְּנ֔וֹ הָרְג֖וּ לְפִי־חָ֑רֶב וַיִּקְח֧וּ אֶת־דִּינָ֛ה מִבֵּ֥ית שְׁכֶ֖ם וַיֵּצֵֽאוּ׃ (כז) בְּנֵ֣י יַעֲקֹ֗ב בָּ֚אוּ עַל־הַ֣חֲלָלִ֔ים וַיָּבֹ֖זּוּ הָעִ֑יר אֲשֶׁ֥ר טִמְּא֖וּ אֲחוֹתָֽם׃ (כח) אֶת־צֹאנָ֥ם וְאֶת־בְּקָרָ֖ם וְאֶת־חֲמֹרֵיהֶּ֑ם וְאֵ֧ת אֲשֶׁר־בָּעִ֛יר וְאֶת־אֲשֶׁ֥ר בַּשָּׂדֶ֖ה לָקָֽחוּ׃ (כט) וְאֶת־כָּל־חֵילָ֤ם וְאֶת־כָּל־טַפָּם֙ וְאֶת־נְשֵׁיהֶ֔ם שָׁב֖וּ וַיָּבֹ֑זּוּ וְאֵ֖ת כָּל־אֲשֶׁ֥ר בַּבָּֽיִת׃ (ל) וַיֹּ֨אמֶר יַעֲקֹ֜ב אֶל־שִׁמְע֣וֹן וְאֶל־לֵוִי֮ עֲכַרְתֶּ֣ם אֹתִי֒ לְהַבְאִישֵׁ֙נִי֙ בְּיֹשֵׁ֣ב הָאָ֔רֶץ בַּֽכְּנַעֲנִ֖י וּבַפְּרִזִּ֑י וַאֲנִי֙ מְתֵ֣י מִסְפָּ֔ר וְנֶאֶסְפ֤וּ עָלַי֙ וְהִכּ֔וּנִי וְנִשְׁמַדְתִּ֖י אֲנִ֥י וּבֵיתִֽי׃ (לא) וַיֹּאמְר֑וּ הַכְזוֹנָ֕ה יַעֲשֶׂ֖ה אֶת־אֲחוֹתֵֽנוּ׃ (פ)
(24) All who went out of the gate of his town heeded Hamor and his son Shechem, and all males, all those who went out of the gate of his town, were circumcised. (25) On the third day, when they were in pain, Simeon and Levi, two of Jacob’s sons, brothers of Dinah, took each his sword, came upon the city unmolested, and slew all the males. (26) They put Hamor and his son Shechem to the sword, took Dinah out of Shechem’s house, and went away. (27) The other sons of Jacob came upon the slain and plundered the town, because their sister had been defiled. (28) They seized their flocks and herds and asses, all that was inside the town and outside; (29) all their wealth, all their children, and their wives, all that was in the houses, they took as captives and booty. (30) Jacob said to Simeon and Levi, “You have brought trouble on me, making me odious among the inhabitants of the land, the Canaanites and the Perizzites; my men are few in number, so that if they unite against me and attack me, I and my house will be destroyed.” (31) But they answered, “Should our sister be treated like a whore?”
(י) כִּֽי־תִקְרַ֣ב אֶל־עִ֔יר לְהִלָּחֵ֖ם עָלֶ֑יהָ וְקָרָ֥אתָ אֵלֶ֖יהָ לְשָׁלֽוֹם׃ (יא) וְהָיָה֙ אִם־שָׁל֣וֹם תַּֽעַנְךָ֔ וּפָתְחָ֖ה לָ֑ךְ וְהָיָ֞ה כָּל־הָעָ֣ם הַנִּמְצָא־בָ֗הּ יִהְי֥וּ לְךָ֛ לָמַ֖ס וַעֲבָדֽוּךָ׃ (יב) וְאִם־לֹ֤א תַשְׁלִים֙ עִמָּ֔ךְ וְעָשְׂתָ֥ה עִמְּךָ֖ מִלְחָמָ֑ה וְצַרְתָּ֖ עָלֶֽיהָּ׃ (יג) וּנְתָנָ֛הּ יְהוָ֥ה אֱלֹהֶ֖יךָ בְּיָדֶ֑ךָ וְהִכִּיתָ֥ אֶת־כָּל־זְכוּרָ֖הּ לְפִי־חָֽרֶב׃ (יד) רַ֣ק הַ֠נָּשִׁים וְהַטַּ֨ף וְהַבְּהֵמָ֜ה וְכֹל֩ אֲשֶׁ֨ר יִהְיֶ֥ה בָעִ֛יר כָּל־שְׁלָלָ֖הּ תָּבֹ֣ז לָ֑ךְ וְאָֽכַלְתָּ֙ אֶת־שְׁלַ֣ל אֹיְבֶ֔יךָ אֲשֶׁ֥ר נָתַ֛ן יְהוָ֥ה אֱלֹהֶ֖יךָ לָֽךְ׃ (טו) כֵּ֤ן תַּעֲשֶׂה֙ לְכָל־הֶ֣עָרִ֔ים הָרְחֹקֹ֥ת מִמְּךָ֖ מְאֹ֑ד אֲשֶׁ֛ר לֹא־מֵעָרֵ֥י הַגּֽוֹיִם־הָאֵ֖לֶּה הֵֽנָּה׃ (טז) רַ֗ק מֵעָרֵ֤י הָֽעַמִּים֙ הָאֵ֔לֶּה אֲשֶׁר֙ יְהוָ֣ה אֱלֹהֶ֔יךָ נֹתֵ֥ן לְךָ֖ נַחֲלָ֑ה לֹ֥א תְחַיֶּ֖ה כָּל־נְשָׁמָֽה׃
(10) When you approach a town to attack it, you shall offer it terms of peace. (11) If it responds peaceably and lets you in, all the people present there shall serve you at forced labor. (12) If it does not surrender to you, but would join battle with you, you shall lay siege to it; (13) and when the LORD your God delivers it into your hand, you shall put all its males to the sword. (14) You may, however, take as your booty the women, the children, the livestock, and everything in the town—all its spoil—and enjoy the use of the spoil of your enemy, which the LORD your God gives you. (15) Thus you shall deal with all towns that lie very far from you, towns that do not belong to nations hereabout. (16) In the towns of the latter peoples, however, which the LORD your God is giving you as a heritage, you shall not let a soul remain alive.
(יט) כִּֽי־תָצ֣וּר אֶל־עִיר֩ יָמִ֨ים רַבִּ֜ים לְֽהִלָּחֵ֧ם עָלֶ֣יהָ לְתָפְשָׂ֗הּ לֹֽא־תַשְׁחִ֤ית אֶת־עֵצָהּ֙ לִנְדֹּ֤חַ עָלָיו֙ גַּרְזֶ֔ן כִּ֚י מִמֶּ֣נּוּ תֹאכֵ֔ל וְאֹת֖וֹ לֹ֣א תִכְרֹ֑ת כִּ֤י הָֽאָדָם֙ עֵ֣ץ הַשָּׂדֶ֔ה לָבֹ֥א מִפָּנֶ֖יךָ בַּמָּצֽוֹר׃ (כ) רַ֞ק עֵ֣ץ אֲשֶׁר־תֵּדַ֗ע כִּֽי־לֹא־עֵ֤ץ מַאֲכָל֙ ה֔וּא אֹת֥וֹ תַשְׁחִ֖ית וְכָרָ֑תָּ וּבָנִ֣יתָ מָצ֗וֹר עַל־הָעִיר֙ אֲשֶׁר־הִ֨וא עֹשָׂ֧ה עִמְּךָ֛ מִלְחָמָ֖ה עַ֥ד רִדְתָּֽהּ׃ (פ)
(19) When in your war against a city you have to besiege it a long time in order to capture it, you must not destroy its trees, wielding the ax against them. You may eat of them, but you must not cut them down. Are trees of the field human to withdraw before you into the besieged city? (20) Only trees that you know do not yield food may be destroyed; you may cut them down for constructing siegeworks against the city that is waging war on you, until it has been reduced.

(ט) כָּל אִילַן סְרָק מֻתָּר לָקֹץ אוֹתוֹ וַאֲפִלּוּ אֵינוֹ צָרִיךְ לוֹ. וְכֵן אִילַן מַאֲכָל שֶׁהִזְקִין וְאֵינוֹ עוֹשֶׂה אֶלָּא דָּבָר מוּעָט שֶׁאֵינוֹ רָאוּי לִטְרֹחַ בּוֹ מֻתָּר לָקֹץ אוֹתוֹ. וְכַמָּה יְהֵא הַזַּיִת עוֹשֶׂה וְלֹא יְקֻצֶּנּוּ. רֹבַע הַקַּב זֵיתִים. וְדֶקֶל שֶׁהוּא עוֹשֶׂה קַב תְּמָרִים לֹא יְקֻצֶּנּוּ:

(י) וְלֹא הָאִילָנוֹת בִּלְבַד. אֶלָּא כָּל הַמְשַׁבֵּר כֵּלִים. וְקוֹרֵעַ בְּגָדִים. וְהוֹרֵס בִּנְיָן. וְסוֹתֵם מַעְיָן. וּמְאַבֵּד מַאֲכָלוֹת דֶּרֶךְ הַשְׁחָתָה. עוֹבֵר בְּלֹא תַשְׁחִית. וְאֵינוֹ לוֹקֶה אֶלָּא מַכַּת מַרְדּוּת מִדִּבְרֵיהֶם:

(9) It is permitted to cut down a non-fruit-bearing tree even if the tree itself is not needed. Similarly, an old fruit-bear tree which only produces a small yield and is not worth the effort to maintain can be cut down. And how much olive yield must an olive tree produce for it not to be cut down? A quarter of a Kav of olives. A palm tree which produces a Kav of dates may not be cut down.

(10) And not only regarding trees, but even one who destructively breaks vessels or rips up clothing or tears down a building or seals up a spring or wastes food violates the Negative Commandment of “Do not destroy”. However, he only receives stripes for disobedience, in accordance with the Rabbis.

רש"י דברים פרשת שופטים פרק כ

(י) כי תקרב אל עיר - במלחמת הרשות הכתוב מדבר, כמו שמפורש בענין (פסוק טו) כן תעשה לכל הערים הרחוקות וגו':

Rashi Commentary on Deuteronomy

When you come close to the city- The verse refers to an optional war, as is explicitly stated later (in verse 15) "so shall you do to all the cities which are distant..."