Appointing a (Melekh)
When Bnei Yisrael enter Eretz Yisrael, they are commanded to fulfill three mitzvot: They must appoint a king, destroy all of Amalek, and build the Beit Hamikdash (Sanhedrin 20b, as codified by the Rambam, Hilkhot Melakhim 1:1). The Rambam goes on to say that the mitzva of appointing a king precedes and seems to be a prerequisite to the other two mitzvot.
The question was raised why God was so angered by the request of Bnei Yisrael to appoint a king in the time of Shmuel? After all, it is a mitzva to have a king, and they were merely performing God's will. (See I Shmuel 8:4-8; Sifrei Devarim 17:28; Rambam ibid. 1:2; Meiri Horayot 11b.) The Rambam answered that their request was not motivated by a desire to fulfill the mitzva. It was really a rebellion against Shmuel Hanavi, as it says, "They despised me" (I Shmuel 8:7). Therefore, their request was considered improper.
The Meiri (ibid.) suggested that monarchy is reserved for the tribe of Yehuda. Apparently, at that particular time, there was no appropriate candidate from Shevet Yehuda to serve as king. Therefore, the request to appoint a king at that time was improper. God's response was they may appoint a "temporary" king who could rule until a suitable person would emerge from Shevet Yehuda. It was wrong to demand a king when there was no suitable candidate from Shevet Yehuda.
In the Gemara (Sanhedrin 20b), there are three opinions regarding Jewish monarchy in general. R' Nechemia said that the entire issue of appointing a king was written in order to alarm the community to the dangers inherent in monarchy. The mitzva is phrased as a conditional statement which is not obligatory: "When you enter the land which is given to you by God, and possess it and settle, and then say, 'I wish to appoint a king'" (Devarim 17:14). There is no mitzva to appoint a king, but, if you wish, you may do so. The Navi then warns us of the absolute power of a king who may conscript soldiers, confiscate property, etc. (I Shmuel 8:11-18)
R' Nehorai agreed with R' Nechemia that there is no obligation to appoint a king. He said that it is always better not to have a king. However, if the people choose to have a king "like all the other nations in out area," the Torah allowed it. Since the Torah added this phrase, it implied that any request to appoint a king is motivated by a desire to emulate other nations. It is obviously more appropriate for Am Yisrael to retain its unique identity and proclaim that God alone is our king. Human beings should be political and military leaders, but the kingdom should be reserved for God.
R' Yehuda said that there is a positive mitzva to appoint a king.
It seems that the Rambam codified the opinion of R' Yehudah, even though the majority opinion is that monarchy is not the desirable form of government.
R' Yitzchak Abarbanel was strongly opposed to monarchy. He claimed that there is, in fact, no opinion in the Gemara that there is a mitzva to appoint a king. He pointed out that the Torah actually said that IF the people ask for a king, then we are allowed to appoint a Jewish king. The Torah emphasized that we may not appoint a non-Jewish king. The Torah discussed a situation which may arise in the future (Bnei Yisrael may ask for a king), but did not mandate that there is a mitzva to appoint a king.
In fact, the Abarbanel claimed that even the Rambam did not think that appointing a king was mitzva. The Rambam did not state simply that there is a mitzva to appoint a king. He said that there is a mitzva to appoint a Jewish king. Abarbanel thought that this merely meant that if Bnei Yisrael ask for a king, the appointee must be Jewish. (See the lengthy comments of Abarbanel on Devarim 17.) Many people have disputed this opinion of Abarbanel, and especially reject his understanding of the Rambam. (See Sefer Ha-mitzvot of Rabbeinu Saadyah Gaon v. 3 pg. 230.) There are variant texts in the Frankel edition which read that there is a mitzva to appoint a king for the Jewish people. This text would certainly contradict the Abarbanel's understanding.
There definitely does seem to be a prohibition not to appoint a non-Jewish king. "You can not appoint a foreigner who is not your brother" (Devarim 17:15). The Rambam explains that this excludes converts as well as non-Jews. In fact, the Rambam codified that a convert may not be appointed to any position of authority (Hilkhot Melakhim 1:4).
The Jewish monarchy is reserved for the Davidic family. The Gemara (Yoma 72b) and Midrash Kohelet (7:1) say that David attained the crown of kingdom, and the Rambam ruled "once David was anointed, he attained the crown of kingdom, and kingdom belongs to him and to his male lineage (if they are fitting) forever" (Hilkhot Melakhim 1:7). In fact, the Rambam polemicized that "anyone who believes in Torat Moshe, the master of all prophets, has no king other than from the lineage of David and Shlomo" (Sefer Ha-mitzvot,
Of course, the Rambam recognized the fact that other "kings," such as Yerovam, were appointed by prophets, such as Achiyah Hashiloni. The Rambam ruled that such appointments are valid and all laws of monarchy do apply to them. He apparently understood that David's kingdom is eternal, while other families could rule as kings for limited time periods (Rambam ibid. 1:8-12). We are enjoined from giving the permanent crown of David to someone from another family. However, there may be temporary kings from any family.
Another example of a non-Davidic kingdom is found at the time of the second temple. "The Chashmonai high priests overcame [their enemies], rescued the people of Israel, appointed a king from the Kohanim, and the monarchy of Israel was restored for more than two hundred years until the second destruction" (Rambam, Hilkhot Chanuka 3:1).
The Ramban (Bereishit 49:10) totally disagreed with the opinion of the Rambam. The Rambam explained that a Navi appointed the king in the name of God. The Ramban asked why it was necessary to forbid appointing a non-Jewish (or non-Davidic) king. The Navi certainly would not appoint such a person. Perhaps the Rambam only felt that it was preferable for the Navi to appoint the king. However, if there were no Navi, the king could be appointed by the people. They were therefore instructed not to appoint a "foreigner".
This approach could lead to a discussion if there were no Navi and the general populace elected a leader, what is his status? Could he be considered a king (temporarily at least, since he is not of the Davidic line) at all? Would the laws (or at least some of them) apply to him at all? While this issue is beyond the scope of this article, the interested reader may see Radvaz (Hilkhot Melakhim), Rav Kook's Mishpat Kohen, R' Federbush's Mishpat Hamelukha B'yisrael, as well as more modern articles in various Israeli journals.
Another answer to the question of the Ramban could be suggested if we follow the reasoning of R' Nechemia, R' Nehorai, or the Abarbanel's interpretation of the Rambam. There really is no mitzva at all to appoint a king. However, if there is a popular request for a king, the Torah told us that we could (or should) appoint one. However, the Torah forbade us from appointing a non-Jewish king. This may mean that if the community asks for a foreign monarch, we need (should) not acquiesce to their wish. While it is unthinkable that a Navi would appoint a foreigner, it certainly is possible that the community could request such a personage, and the Navi would not then have to appoint anyone.
It is interesting to note that a king is appointed. The Vilna Gaon pointed out that a melekh is appointed, but a moshel (dictator) is self-appointed. When Yosef related his dreams to his brothers, they asked him, "Do you plan to be a melech; do you think you will be a moshel?" Ibn Ezra commented that the question is not redundant. They firstly rejected any suggestion that they would appoint him. They then added that he should not think that he would rule by force.
God is a melekh to the Jews, who accept His kingdom. However, He is only a moshel to non-Jews. We anticipate and pray for the day that God's kingdom will be accepted by all mankind. Then God will truly be one and His name will be one. (Daily prayer after Az Yashir.)