Summary: Negative Mitzvah #46 is that it is forbidden for Jews to dwell in Egypt. The next two mitzvot prohibit dealing with the seven Canaanite nations, followed by two mitzvot prohibiting having mercy on idolaters or to allow them to settle in Israel. Then comes the prohibition of intermarrying with gentiles (specifically idolaters), and a separate mitzvah not to allow Ammonite or Moabite men to marry Israelite women. There is a related mitzvah (#56) not to seek peace treaties with Ammonites or Moabites. Mitzvah #54 and 55 is to allow Edomite or Egyptian converts to formally join the nation, but only after three generations. In other words, they would only be considered full-fledged Jews and Israelites three generations after having converted. Mitzvah #57 is the famous bal tashchit, not to destroy fruit trees nor, by extension, to carelessly destroy anything of value. The next mitzvah is for soldiers not to have fear in war, then not to forget the evil deeds of Amalek, and not to curse God’s Name. The next four are related: not to break an oath taken in God’s Name, nor to take an oath in vain to begin with, not to profane God’s Name (the opposite of doing a kiddush Hashem), and not to test God. Mitzvah #65 is not to destroy anything sacred, whether a written Name of God, a Torah scroll, a synagogue, or the Holy Temple. The mitzvah that follows is not to leave the corpse of an executed person on the gallows. It should be removed and buried promptly. The next 12 mitzvot all have to do with kohanim and Levi’im serving in the Temple, including that they may not be inebriated, and that they must be in a state of purity. Mitzvah #79 is that the Temple must not be built with stones hewn using iron tools, since iron is an implement of war, and the Temple is a house of peace. (To learn more about how the Temple stones were cut without iron, see ‘Mystery of the Shamir‘.)
Insight: The Torah states clearly that it is forbidden for Jews to dwell in Egypt, now that they had been freed and led away from there by God. What’s amazing is that the Rambam himself lived in Egypt! In fact, since the destruction of the First Temple, Egypt always had large and thriving Jewish communities. Alexandria was once the largest Jewish city (by population) in the world. Incredibly, there was even a “Holy Temple” of sorts set up in Leontopolis, Egypt, established by a legitimate though renegade kohen, and the Talmud debates whether it is permitted to bring sacrifices there. Archaeologists discovered yet another Jewish Temple on the Egyptian island of Elephantine, which similarly once boasted a large Jewish community. (For more on these, see ‘The Secret History of the Holy Temple’ in Garments of Light, Volume Two.) The Egyptian Jewish community persisted until modern times, and was only extinguished following the establishment of the State of Israel. One of its last chief rabbis was Rav Ovadia Yosef. So, how was this possible? Why did Jews settle in Egypt when it was forbidden by the Torah? Some say the Torah only specifically forbid that Exodus generation from returning to Egypt. The decree was not meant for all time. Another explanation is that the Torah forbade settling in the ancient pagan, impure Egypt. That Egypt was expunged first by the Persian Empire, and then absorbed into the empire of Alexander the Great, following which it was ruled by Greeks, and then Romans. In other words, it was no longer really “Egypt”. By the time of the Rambam, Egypt had nothing to do with pagan ancient Egypt and was an entirely Arab Muslim, monotheistic land, ruled and populated by a completely different ethnicity, culture, and religion. Thus, there was no prohibition to settle there. Finally, there are those who say that Jewish communities in Egypt never meant to permanently “settle” there, and were only living there temporary due to the exile, with the expectation that at any moment the Final Redemption would come and they would all permanently settle in the Holy Land of Israel.