When you come to the Land that Hashem, your G-d, gives you, and possess it, and settle in it, and you will say, “I will set a king over myself, like all the nations that are around me.” You shall surely set over yourself a king whom Hashem, your G-d, shall choose... (Deut. 17:14-15)
It shall be when he sits on the throne of his kingdom, he shall write for himself two copies of this Torah in a book, from before the Kohanim, the Levites. (Deut. 17:18)
The Jewish government, the king and the police apparatus were mainly intended to run the Jewish State as a theocracy in accordance with G-d's mitzvot. Regarding the verse, “Appoint yourselves judges and police [officers] (Deut. 16:18), R. Eliezer ben Shamua says (Sifri, Shoftim, 144), “If there are police, there are judges. If there are no police, there are no judges.” The intent is clear: If there are police to enforce the judge's Torah rulings, then the judges' word will endure. Otherwise, it is as though there are no judges. Their rulings are then nothing but a farce. In essence, G-d commanded that there be governmental coercion so as to ensure that the people follow G-d's path. G-d scornfully cast off of Himself and of us the alien non-Jewish opposition to “religious coercion”, opposition that is nothing but rebellion against G-d and His decrees. Sefer haChinuch wrote (Mitzvah 491): To appoint judges and policemen who will coerce mitzvah observance and restore to it by force those who have strayed from the truth. They will command regarding what is appropriate to do and will prevent unsavory acts from occurring, and they will uphold punishments against violators until people cease to relate to the mitzvot and prohibitions according to how they personally interpret them. This concept stands in absolute opposition to the alien culture and to the licentiousness and abominations at its core.
The non-Jews worship many idols and follow many alien cultures, all of them false; and even looking from their point of view, we cannot tell who and which of them they consider “truth”. Therefore, with them there is certainly a need to follow the majority, since they lack any clear truth. This is why the system of majority rule was created. For Jacob, however, there is only one truth, and it does not matter whether the whole world differs with it, because it is impossible to decide against the truth. Even if, to our great chagrin, most of Israel choose falsehood over Torah, that does not matter, since Jacob already has the truth. Thus, it is explicit that among Israel there is just one viewpoint, that of Torah; and even if a majority of the Jewish People differ with it, their view is considered deviant and is discounted. A great rabbi once gave a reason for this: The law is that we do not follow the majority when there is testimony for the opposing view; and since Israel saw the Sinai Revelation with their own eyes, confirming G-d's existence, no majority in the world could decide anything against this testimony (SeeTorah Shlemah, Shemot, 23, se'if katan 38). R. Chama's comment[...] - “If one of them sins, it is attributed to them all” (Midrash HaGadol, Shemot, 1:5) - ...] serves to establish the other side of the rule that there is one truth, and not two. Not only must the righteous minority not surrender to or tolerate the erring majority, but they have a duty to protest against them. Not only must they not accept their viewpoint, but they must also demand that they correct their error and accept G-d's viewpoint. The mutual responsibility which exists among the Jewish People requires every Jew to share in the fate of his fellow; and if he does not protest the sins of the individual, let alone those of the community, he, too, will be punished.
[Regarding “You shall surely set over yourself a king whom Hashem, your G-d, shall choose...” (Deut. 17:15)] Rambam wrote (Hilchot Malachim 1:3), “Initially, a king is appointed by the Sanhedrin of seventy-one following a prophetic decree.” Initially, such is the law, but if in certain circumstances it proves impossible, then we satisfy our requirement of a regime to ward off licentiousness and enemy attack via a president rather than a king – without a Sanhedrin or prophet. Rambam taught (Ibid. 1:8): If a prophet appointed a king from another tribe [rather than Yehudah], and that king followed the path of Torah and mitzvot and fought G-d's battles, he is a king, and all the mitzvot of the monarchy apply to him, even though the main monarchy is through David. Thus, even when there is no Davidic dynasty for whatever reason, we still continue with a monarchic regime, rule by one man. [And further,] even when there is no prophet or Sanhedrin, there clearly remains a need for a one-man regime, a single leader, a president, and not the utter chaos of dozens or hundreds of representatives and parties, every one of which tries to extort money and power, leaving the county paralyzed while they try to reach agreement on matters of paramount importance. Presumably, the appointment must approximate the ideal format, in that it should be implemented by a court of the great rabbis of the generation. This is clearly the type of regime that G-d desired; and when there is a prophet and Sanhedrin, then together with the king who stands at their head, they comprise a Torah regime of “one leader to the generation, not two.”
The king or ruler is obligated to view himself as G-d's representative to herd His holy flock, Israel, and to conduct himself with them in ways that will be beneficial to them, and all in accordance with the ways of the Torah, as I have written. He must listen seriously to their complaints. The ruler must conduct himself with humility, as a servant of the people, yet he must know that he is king or president, G-d's representative not only to defend the Jewish people, but also lead and direct them on the path they must follow. He must fear no man and be deterred by no one, and he must not try to curry favor with the people or flatter them. Of this it says, “Do not flatter the land in which you live” (Num. 35:33). Rather, where necessary, he must take a staff and smite their skulls. Then G-d will be at his side.
Clearly, the government's whole worth is solely as a means towards the proper running of G-d's state. It is inconceivable that there could be any valid authority to a government that does not conduct itself this way. The monarchy, or whatever government there may be, was intended only to fulfill the Divine mission assigned it by Divine decree. Thus, all the rights and authority of Jewish governments stem solely from the Torah. A Jewish government must not resemble any regime of the nations, because the government, state and people, themselves, were created only to obey G-d. Rashi explains (Sanhedrin 49a, s.v. Achin veRakin): “If the king sets out to nullify Torah pronouncements, we do not heed him.”
[As Rabbi Kahane explains in Peirush HaMaccabee – Devarim, Parashat Shoftim:] Judges and officers shall you appoint in all your cities... and they shall judge the people with righteous judgment. (Deut. 16:18) The Sforno writes: “After the mitzvot which apply to the masses [the three pilgrimage festivals, at the end of the previous Parasha] the Torah gives the commandments which apply to their leaders, who are the kings and the judges and the Kohanim and the prophets. As long as they act properly, the masses, too, will behave properly; but if they are corrupt-then they will corrupt the masses.” We learn from this that the way to a just and proper society does not depend upon the method of government – that is, a specific political or economic idea – but rather the essence and nature and quality of the people who are the society's leaders. If the judges are just, then a fair and just society will be created; and if they are corrupt, then society as a whole will be corrupted; whatever its form of government or its ideology.
[Rabbi Kahane also refers to this in “Why be Jewish”: ] It is illusion to believe that one can make a people better by [just] changing the form of government. No change in the system of society will make that society better, for there is no such thing as “government” or “society”. There are only the individuals who comprise the government or the society and the whole is nothing more than the sum of its parts. If the parts are rotten and corrupt, the whole must emerge the same. If the people are selfish and egotistical, society will emerge the same, regardless of the form of government that it uses. An ugly world will never be made beautiful by attacking the symptoms. It is man himself who must be changed and made better. Then and only then can the world which he makes up become better, too. The holiness of the human being guarantees the holiness and beauty of his world. Even if this is a long and difficult process, it is the only way. Of such things did the rabbis say: “There is a long way that is short and a seemingly short way that is in reality long.” And how does one change man's natural inclination to be selfish? “The commandments were given to Israel to purify people”. Here is the way the Almighty, creator of man who knows all of his workings and ways, knew that man could be brought to holiness and purity. The mitzvot, the commandments – they are the way, the only way. “And you shall fulfill all my commandments, and then shall you be holy unto your G-d."