A king should not wage other wars before a milchemet mitzvah. What is considered as milchemet mitzvah? The war against the seven nations who occupied Eretz Yisrael, the war against Amalek, and a war fought to assist Israel from an enemy which attacks them.
Afterwards, he may wage a milchemet hareshut, i.e., a war fought with other nations in order to expand the borders of Israel or magnify its greatness and reputation.
אאֵין הַמֶּלֶךְ נִלְחָם תְּחִלָּה אֶלָּא מִלְחֶמֶת מִצְוָה. וְאֵי זוֹ הִיא מִלְחֶמֶת מִצְוָה זוֹ מִלְחֶמֶת שִׁבְעָה עֲמָמִים. וּמִלְחֶמֶת עֲמָלֵק. וְעֶזְרַת יִשְׂרָאֵל מִיַּד צָר שֶׁבָּא עֲלֵיהֶם. וְאַחַר כָּךְ נִלְחָם בְּמִלְחֶמֶת הָרְשׁוּת וְהִיא הַמִּלְחָמָה שֶׁנִּלְחָם עִם שְׁאָר הָעַמִּים כְּדֵי לְהַרְחִיב גְּבוּל יִשְׂרָאֵל וּלְהַרְבּוֹת בִּגְדֻלָּתוֹ וְשִׁמְעוֹ:
There is no need to seek the permission of the court to wage a milchemet mitzvah. Rather, he may go out on his own volition and force the nation to go out with him. In contrast, he may not lead the nation out to wage a milchemat hareshut unless the court of seventy one judges approves.
במִלְחֶמֶת מִצְוָה אֵינוֹ צָרִיךְ לִטּל בָּהּ רְשׁוּת בֵּית דִּין. אֶלָּא יוֹצֵא מֵעַצְמוֹ בְּכָל עֵת. וְכוֹפֶה הָעָם לָצֵאת. אֲבָל מִלְחֶמֶת הָרְשׁוּת אֵינוֹ מוֹצִיא הָעָם בָּהּ אֶלָּא עַל פִּי בֵּית דִּין שֶׁל שִׁבְעִים וְאֶחָד:
The king may burst through the fences surrounding fields or vineyards to make a road and no one can take issue with him.
There is no limit to the road the king may make. Rather, it may be as wide as necessary. He need not make his road crooked because of an individual's vineyard or field. Rather, he may proceed on a straight path and carry out his war.
גוּפוֹרֵץ לַעֲשׂוֹת לוֹ דֶּרֶךְ וְאֵין מְמַחִין בְּיָדוֹ. וְדֶרֶךְ הַמֶּלֶךְ אֵין לָהּ שִׁעוּר. אֶלָּא כְּפִי מַה שֶּׁהוּא צָרִיךְ. אֵינוֹ מְעַקֵּם הַדְּרָכִים מִפְּנֵי כַּרְמוֹ שֶׁל זֶה אוֹ מִפְּנֵי שָׂדֵהוּ שֶׁל זֶה. אֶלָּא הוֹלֵךְ בְּשָׁוֶה וְעוֹשֶׂה מִלְחַמְתּוֹ:
It is a positive commandment to annihilate the seven nations who dwelled in Eretz Yisrael as Deuteronomy 20:17 states: "You shall utterly destroy them."
Anyone who chances upon one of them and does not kill him violates a negative commandment as ibid.:16 states: "Do not allow a soul to live." The memory of them has already been obliterated.
דמִצְוַת עֲשֵׂה לְהַחֲרִים שִׁבְעָה עֲמָמִין שֶׁנֶּאֱמַר (דברים כ יז) "הַחֲרֵם תַּחֲרִימֵם". וְכָל שֶׁבָּא לְיָדוֹ אֶחָד מֵהֶן וְלֹא הֲרָגוֹ עוֹבֵר בְּלֹא תַּעֲשֶׂה שֶׁנֶּאֱמַר (דברים כ טז) "לֹא תְחַיֶּה כָּל נְשָׁמָה". וּכְבָר אָבַד זִכְרָם:
Similarly, it is a positive commandment to destroy the memory of Amalek, as Deuteronomy 25:19 states: "Obliterate the memory of Amalek."
It is also a positive commandment to constantly remember their evil deeds and their ambush of Israel to arouse our hatred of them, as ibid.:17 states: "Remember what Amalek did to you." The Oral Tradition teaches: "...Remember" - with your mouths; "...Do not forget" - in your hearts. For it is forbidden to forget our hatred and enmity for them.
הוְכֵן מִצְוַת עֲשֵׂה לְאַבֵּד זֵכֶר עֲמָלֵק. שֶׁנֶּאֱמַר (דברים כה יט) "תִּמְחֶה אֶת זֵכֶר עֲמָלֵק". וּמִצְוַת עֲשֵׂה לִזְכֹּר תָּמִיד מַעֲשָׂיו הָרָעִים וַאֲרִיבָתוֹ. כְּדֵי לְעוֹרֵר אֵיבָתוֹ. שֶׁנֶּאֱמַר (דברים כה יז) "זָכוֹר אֵת אֲשֶׁר עָשָׂה לְךָ עֲמָלֵק". מִפִּי הַשְּׁמוּעָה לָמְדוּ זָכוֹר בַּפֶּה לֹא תִּשְׁכָּח בַּלֵּב. שֶׁאָסוּר לִשְׁכֹּחַ אֵיבָתוֹ וְשִׂנְאָתוֹ:
Mishneh Torah (Moznaim)
Featuring a modern English translation and a commentary that presents a digest of the centuries of Torah scholarship which have been devoted to the study of the Mishneh Torah by Maimonides.
All the lands which Israel conquers in wars led by a king and approved by the court are considered as conquered by the people at large. Thus, they have the same status as Eretz Yisrael which was conquered by Joshua in every regard. This only applies if they were conquered after the conquest of Eretz Yisrael as described in the Torah.
וכָּל הָאֲרָצוֹת שֶׁכּוֹבְשִׁין יִשְׂרָאֵל בְּמֶלֶךְ עַל פִּי בֵּית דִּין. הֲרֵי זֶה כִּבּוּשׁ רַבִּים וַהֲרֵי הִיא כְּאֶרֶץ יִשְׂרָאֵל שֶׁכָּבַשׁ יְהוֹשֻׁעַ לְכָל דָּבָר. וְהוּא שֶׁכָּבְשׁוּ אַחַר כִּבּוּשׁ כָּל אֶרֶץ יִשְׂרָאֵל הָאֲמוּרָה בַּתּוֹרָה:
It is permitted to dwell anywhere in the entire world with the exception of the land of Egypt. Its territory includes a square of 400 parsah by 400 parsah from the Mediterranean Sea proceeding westward, bordering on the land of Kush and the desert. It is forbidden to dwell in this entire territory.
In three places, the Torah warned against returning to Egypt:
a) "God has told you, you must never again return on that path" (Deuteronomy 17:16);
b) "You shall not see it again" (Deuteronomy 28:68);
c) "You shall never see them again forever" (Exodus 14:13).
Alexandria is included in this prohibition.
זוּמֻתָּר לִשְׁכֹּן בְּכָל הָעוֹלָם חוּץ מֵאֶרֶץ מִצְרַיִם. מִן הַיָּם הַגָּדוֹל וְעַד הַמַּעֲרָב אַרְבַּע מֵאוֹת פַּרְסָה עַל אַרְבַּע מֵאוֹת פַּרְסָה כְּנֶגֶד אֶרֶץ כּוּשׁ וּכְנֶגֶד הַמִּדְבָּר. הַכּל אָסוּר לְהִתְיַשֵּׁב בָּהּ. בִּשְׁלֹשָׁה מְקוֹמוֹת הִזְהִירָה תּוֹרָה שֶׁלֹּא לָשׁוּב לְמִצְרַיִם. שֶׁנֶּאֱמַר (דברים יז טז) "לֹא תֹסִפוּן לָשׁוּב בַּדֶּרֶךְ הַזֶּה עוֹד". (דברים כח סח) "לֹא תֹסִיף עוֹד לִרְאֹתָהּ". (שמות יד יג) "לֹא תֹסִפוּ לִרְאֹתָם עוֹד עַד עוֹלָם". וַאֲלֶכְּסַנְדְּרִיאָה בִּכְלַל הָאִסּוּר:
It is permitted to return to Egypt for the purpose of trade and commerce and to pass through while conquering other nations. The prohibition consists of settling there.
Lashes are not given as punishment for the violation of this prohibition because at the time one enters, there is no prohibition. Should he decide to settle there, there is no deed involved.
It appears to me that if a king of Israel would conquer the land of Egypt with the approval of the court, it would be permissible to settle there. The prohibition against returning was only given to individuals or to dwell there while it is under the rule of the gentiles for their behavior is more depraved than that of the peoples of other lands as can be inferred from Leviticus 18:3: "Do not follow the ways of Egypt...."
חמֻתָּר לַחְזֹר לְאֶרֶץ מִצְרַיִם לִסְחוֹרָה וְלִפְרַקְמַטְיָא. וְלִכְבֹּשׁ אֲרָצוֹת אֲחֵרוֹת. וְאֵין אָסוּר אֶלָּא לְהִשְׁתַּקֵעַ שָׁם. וְאֵין לוֹקִין עַל לָאו זֶה. שֶׁבְּעֵת הַכְּנִיסָה מֻתָּר הוּא. וְאִם יַחֲשֹׁב לֵישֵׁב וּלְהִשְׁתַּקֵעַ שָׁם אֵין בּוֹ מַעֲשֶׂה. וְיֵרָאֶה לִי שֶׁאִם כָּבַשׁ אֶרֶץ מִצְרַיִם מֶלֶךְ יִשְׂרָאֵל עַל פִּי בֵּית דִּין שֶׁהִיא מֻתֶּרֶת. וְלֹא הִזְהִירָה אֶלָּא לָשׁוּב לָהּ יְחִידִים אוֹ לִשְׁכֹּן בָּהּ וְהִיא בְּיַד עַכּוּ''ם מִפְּנֵי שֶׁמַּעֲשֶׂיהָ מְקֻלְקָלִין יוֹתֵר מִכָּל הָאֲרָצוֹת. שֶׁנֶּאֱמַר (ויקרא יח ג) "כְּמַעֲשֵׂה אֶרֶץ מִצְרַיִם":
It is forbidden to leave Eretz Yisrael for the Diaspora at all times except:
to study Torah;
to marry; or
to save one's property from the gentiles.
After accomplishing these objectives, one must return to Eretz Yisrael.
Similarly, one may leave Eretz Yisrael to conduct commercial enterprises. However, it is forbidden to leave with the intent of settling permanently in the Diaspora unless the famine in Eretz Yisrael is so severe that a dinar's worth of wheat is sold at two dinarim.
When do these conditions apply? When one possesses financial resources and food is expensive. However, if food is inexpensive, but a person cannot find financial resources or employment and has no money available, he may leave and go to any place where he can find relief.
Though it is permitted to leave Eretz Yisrael under these circumstances, it is not pious behavior. Behold, Machlon and Kilyon were two of the great men of the generation and they left Eretz Yisrael only out of great distress. Nevertheless, they were found worthy of death by God.
טאָסוּר לָצֵאת מֵאֶרֶץ יִשְׂרָאֵל לְחוּצָה לָאָרֶץ לְעוֹלָם. אֶלָּא לִלְמֹד תּוֹרָה אוֹ לִשָּׂא אִשָּׁה אוֹ לְהַצִּיל מִן הָעַכּוּ''ם. וְיַחְזֹר לָאָרֶץ. וְכֵן יוֹצֵא הוּא לִסְחוֹרָה. אֲבָל לִשְׁכֹּן בְּחוּצָה לָאָרֶץ אָסוּר אֶלָּא אִם כֵּן חָזַק שָׁם הָרָעָב עַד שֶׁנַּעֲשָׂה שְׁוֵה דִּינָר חִטִּין בִּשְׁנֵי דִּינָרִין. בַּמֶּה דְּבָרִים אֲמוּרִים כְּשֶׁהָיוּ הַמָּעוֹת מְצוּיוֹת וְהַפֵּרוֹת בְּיֹקֶר. אֲבָל אִם הַפֵּרוֹת בְּזוֹל וְלֹא יִמְצָא מָעוֹת וְלֹא בְּמָה יִשְׂתַּכֵּר וְאָבְדָה פְּרוּטָה מִן הַכִּיס. יֵצֵא לְכָל מָקוֹם שֶׁיִּמְצָא בּוֹ רֶוַח. וְאַף עַל פִּי שֶׁמֻּתָּר לָצֵאת אֵינָהּ מִדַּת חֲסִידוּת שֶׁהֲרֵי מַחְלוֹן וְכִלְיוֹן שְׁנֵי גְּדוֹלֵי הַדּוֹר הָיוּ וּמִפְּנֵי צָרָה גְּדוֹלָה יָצְאוּ וְנִתְחַיְּבוּ כְּלָיָה לַמָּקוֹם:
Great sages would kiss the borders of Eretz Yisrael, kiss its stones, and roll in its dust. Similarly, Psalms 102:15 declares: "Behold, your servants hold her stones dear and cherish her dust."
יגְּדוֹלֵי הַחֲכָמִים הָיוּ מְנַשְּׁקִין עַל תְּחוּמֵי אֶרֶץ יִשְׂרָאֵל וּמְנַשְּׁקִין אֲבָנֶיהָ וּמִתְגַּלְגְּלִין עַל עֲפָרָהּ. וְכֵן הוּא אוֹמֵר (תהילים קב טו) "כִּי רָצוּ עֲבָדֶיךָ אֶת אֲבָנֶיהָ וְאֶת עֲפָרָהּ יְחֹנֵנוּ":
The Sages commented: "Whoever dwells in Eretz Yisrael will have his sins forgiven as Isaiah 33:24 states: 'The inhabitant shall not say "I am sick." The people who dwell there shall be forgiven their sins.'"
Even one who walks four cubits there will merit the world to come and one who is buried there receives atonement as if the place in which he is buried is an altar of atonement as Deuteronomy 32:43 states: "His land will atone for His people." In contrast, the prophet, [Amos 7:17, used the expression] "You shall die in an impure land" as a prophecy of retribution.
There is no comparison between the merit of a person who lives in Eretz Yisrael and ultimately, is buried there and one whose body is brought there after his death. Nevertheless, great Sages would bring their dead there. Take an example, from our Patriarch, Jacob, and Joseph, the righteous.
יאאָמְרוּ חֲכָמִים כָּל הַשּׁוֹכֵן בְּאֶרֶץ יִשְׂרָאֵל עֲוֹנוֹתָיו מְחוּלִין. שֶׁנֶּאֱמַר (ישעיה לג כד) "וּבַל יֹאמַר שָׁכֵן חָלִיתִי הָעָם הַיּשֵׁב בָּהּ נְשֻׂא עָוֹן". אֲפִלּוּ הָלַךְ בָּהּ אַרְבַּע אַמּוֹת זוֹכֶה לְחַיֵּי הָעוֹלָם הַבָּא. וְכֵן הַקָּבוּר בָּהּ נִתְכַּפֵּר לוֹ. וּכְאִלּוּ הַמָּקוֹם שֶׁהוּא בּוֹ מִזְבַּח כַּפָּרָה. שֶׁנֶּאֱמַר (דברים לב מג) "וְכִפֶּר אַדְמָתוֹ עַמּוֹ". וּבַפֻּרְעָנוּת הוּא אוֹמֵר (עמוס ז יז) "עַל אֲדָמָה טְמֵאָה תָּמוּת". וְאֵינוֹ דּוֹמֶה קוֹלַטְתּוֹ מֵחַיִּים לְקוֹלַטְתּוֹ אַחַר מוֹתוֹ. וְאַף עַל פִּי כֵן גְּדוֹלֵי הַחֲכָמִים הָיוּ מוֹלִיכִים מֵתֵיהֶם לְשָׁם. צֵא וּלְמַד מִיַּעֲקֹב אָבִינוּ וְיוֹסֵף הַצַּדִּיק:
At all times, a person should dwell in Eretz Yisrael even in a city whose population is primarily gentile, rather than dwell in the Diaspora, even in a city whose population is primarily Jewish.
This applies because whoever leaves Eretz Yisrael for the Diaspora is considered as if he worships idols as I Samuel 26:19 states "They have driven me out today from dwelling in the heritage of God, saying 'Go, serve other gods.'" Similarly, the (Ezekiel 13:9) prophecies of retribution state: "They shall not come to the land of Israel."
Just as it is forbidden to leave the chosen land for the Diaspora, it is also forbidden to leave Babylon for other lands as Jeremiah 27:22 states: "They shall be brought to Babylon and there they shall be until I take heed of them... and restore them to this place."
יבלְעוֹלָם יָדוּר אָדָם בְּאֶרֶץ יִשְׂרָאֵל אֲפִלּוּ בְּעִיר שֶׁרֻבָּהּ עַכּוּ''ם וְאַל יָדוּר בְּחוּצָה לָאָרֶץ וַאֲפִלּוּ בְּעִיר שֶׁרֻבָּהּ יִשְׂרָאֵל. שֶׁכָּל הַיּוֹצֵא לְחוּצָה לָאָרֶץ כְּאִלּוּ עוֹבֵד עֲבוֹדָה זָרָה. שֶׁנֶּאֱמַר (שמואל א כו יט) "כִּי גֵרְשׁוּנִי הַיּוֹם מֵהִסְתַּפֵּחַ בְּנַחֲלַת ה' לֵאמֹר לֵךְ עֲבֹד אֱלֹהִים אֲחֵרִים". וּבַפֻּרְעָנֻיּוֹת הוּא אוֹמֵר (יחזקאל יג ט) "וְאֶל אַדְמַת יִשְׂרָאֵל לֹא יָבֹאוּ". כְּשֵׁם שֶׁאָסוּר לָצֵאת מֵהָאָרֶץ לְחוּצָה לָאָרֶץ כָּךְ אָסוּר לָצֵאת מִבָּבֶל לִשְׁאָר הָאֲרָצוֹת. שֶׁנֶּאֱמַר (ירמיה כז כב) "בָּבֶלָה יוּבָאוּ וְשָׁמָּה יִהְיוּ":