Jewish laws on war
Characteristics: A mandatory war is to be distinguished from a "voluntary war" (מלחמת רשות‎; milḥemet reshūt), that is to say, a battle waged of free choice, which requires the approbation of the Sanhedrin, presumably in order to impose a religious and moral check on reckless warfare. It is also to be distinguished from a "religious war" (מלחמת מצוה‎; milḥemet mitzvah), which is restricted to those nations mentioned in the Hebrew Bible, such as Amalek and the nations of Canaan. The biblical command, in the case of the Canaanite inhabitants, was to exterminate them and to annex their territory, whereas others who made peace with Israel could be enslaved and forced to pay tribute.
For all practical purposes, a mandatory war can be described as a defensive war.

General overview: Specifically relating to the halachic laws governing the Jewish nation, Spanish Jewish rabbi and scholar, Menahem Meiri, has described the conditions needed for there to be a "mandatory war", saying that all wars, excepting those made for the conquest of the Land of Israel (such as at the time of Joshua), are to be deemed as "voluntary wars". A ruler cannot compel the Jewish people to fight in such "voluntary wars" (so-named because the ruler of that nation is either angry at his enemy, or simply wishes to show his prowess, or to extend his territorial domain), unless it be by the authorization of the greater Sanhedrin, composed of seventy-one judges. However, if there were a case whereby the nation of Israel had been attacked by an enemy for any reason, that would be tantamount to a battle waged in a religious cause ("religious war"), in which case it is the bounden duty of all in Israel to fight and resist the enemy, hence: a mandatory war (or battle waged in duty bound). 
Maimonides further explains that whenever Israel finds itself fighting a battle in a religious cause, such as when an oppressor has come upon them in war to destroy them, the people of Israel need not obtain prior permission from the Rabbinic court to fight, but may go forth to the battle, and compel others to do the same.
Wars fought to redeem captives, such as those wars waged by Abraham to free Lot, and by David to free Jewish women and children in Ziklag (1 Sam. 30), are generally categorized as defensive wars.
The Hebrew expressions, Milḥemet mitzvah (religious war) and Milḥemet ḥovah (mandatory war), are sometimes used interchangeably, since they include the reactive defensive wars when Jewish habitations were attacked. Rabbi Yehuda, however, distinguishes between these two expressions.

Rabbinic discussions: [When you go out to war against your enemies, and see horses and chariots and an army larger than your own, you shall not be afraid of them, for the Lord your God is with you, who brought you up out of the land of Egypt, etc. (Deut. 20:1–ff.)] What does the saying here advanced pertain to? Said Rabbi Yehuda: 'The matter concerns a religious war (milḥemet mitzvah). However, in a mandatory war (milḥemet ḥovah), all go forth [into battle], even a bridegroom from his room and a bride from her bridal-chamber.' Our Mishnah [in Soṭah speaks of] when you go out to war against your enemies. The writing [in Mishnah Soṭah] speaks about the voluntary war (milḥemet ha-reshūt) [fought at Israel's own discretion].
One of the fine points arising from the rabbinic discussions on the subject is that, whenever Israel voluntarily wages a battle of free choice against another nation, unto Israel would apply all the conditions mentioned in the Hebrew Bible (Deuteronomy 20:1–ff.) and in Mishnah Soṭah (chapter 8). Although certain persons were permitted by Deuteronomy, chapter 20, to leave the field before a battle began, this was allowed, according to rabbinical opinion, only in case of a voluntary war. Wherefore, a man who has betrothed a wife and has yet to consummate that marriage, or who has planted a vineyard and has yet to partake of its fruit, or who has built a new house and who has not yet lived in that house for a year's time, etc. is exempt from participating in that war. However, if Israel were faced with an existential threat, the conditions of Deuteronomy (chapter 20) and of Mishnah Soṭah (chapter 8) would not apply, as not even a bridegroom is exempt from that war, but must rally behind Israel, and go forth to fight in Israel's defense.  A mandatory war is, therefore, tantamount to a "religious war" and, as such, the general principle applies to everyone: "He that is currently engaged in performing one biblical commandment (i.e. defending Israel), he is exempt from doing another biblical commandment (i.e. cohabiting with his bride, etc.)" (העוסק במצוה פטור מן המצוה‎).

Jewish soldiers conscripted in foreign armies: Although the laws governing a Mandatory war pertain to wars conducted in the Land of Israel, because of an existential threat to the Jewish people, it is still permissible for Jewish soldiers serving in foreign armies to set-out and rescue other Jewish and Gentile soldiers who had been taken captive by enemy forces, since the saving of Jewish life is tantamount to a Religious war, and may be waged without obtaining permission from the Court.

Warfare and the Sabbath-day: In Tractate Eruvin [45a] it was explained that the nations of the world who lay siege to the cities of Israel on the Sabbath-day, the people of Israel are not permitted to go out against them on the Sabbath-day with their armaments, but rather they (the besieged) are to shut themselves up before them and try to observe the laws of Sabbath as much as possible. What does the saying here advanced pertain to? This pertains to a case where it is certain that they have come to take away only money, or objects of money-value. However, if they had come to take away lives, even if it were only a doubtful case, the people of Israel are permitted to go out to battle against them and they desecrate the Sabbath on their account, in order to rescue them. If there was a Jewish city situated along the frontier of the Land of Israel where non-Jewish forces had laid siege to the city, even in such cases where they only came to take away bales of hay and straw, it is permitted for the Jewish nation to go out in battle against the invading army and to desecrate the Sabbath-day in order to save the city.
Elsewhere [ibid.], it was explained that even in the remaining cities and towns of Israel, it is one's bounden duty to go out to battle on their behalf, in order to assist them,  and when they have eventually rescued their fellow countrymen, they are allowed to return to their place [on the Sabbath-day] with their own armaments in hand, seeing that if they were not allowed to do so they would refrain from assisting their brethren in future conflicts.

Ethical question: An ethical question was raised in the early 20th-century about whether or not one is permitted to give-up his own life in order to avert danger to the Jewish people as a whole, both in war and non-war situations, in which the answer posited by Abraham Isaac Kook (1865–1935) and by Shlomo Zalman Pines (1874–1954) was an unequivocal yes, although each man gave different reasons for this allowance. According to Rabbi Kook, "we expose ourselves to the dangers of killing and being killed in accordance with the nature of the world."

See also: Armed conflict
Declaration of war
Judaism and warfare
Jus ad bellum
Just war theory
Law of war
Laws of armed conflict

References: 

Notes: 

Further reading: Grunblatt, Joseph (1968). "Violence and Some Aspects of the Judaic Tradition". Tradition: A Journal of Orthodox Jewish Thought. 10 (2). Rabbinical Council of America (RCA): 42–47. JSTOR 23256251.
Kimelman, Reuven (2023). "Judaism and the Ethics of War". The Cambridge Companion to Religion and War. pp. 215–240. doi:10.1017/9781108884075.013. ISBN 978-1-108-88407-5.


== Bibliography ==