שֹׁפְטִים וְשֹׁטְרִים תִּתֶּן לְךָ בְּכָל שְׁעָרֶיךָ אֲשֶׁר יְהוָה אֱלֹהֶיךָ נֹתֵן לְךָ לִשְׁבָטֶיךָ וְשָׁפְטוּ אֶת הָעָם מִשְׁפַּט צֶדֶק
Judges and officers shall you appoint in all your gates . . . and they shall judge the people with just judgment. (Deuteronomy 16:16)
Rashi comments: appoint judges who are expert and righteous to render righteous judgment
Rashi meant by this that Moses, here, was not commanding the judges to render righteous judgment but rather was commanding those who would select the judges to choose righteous and upright judges who could be expected to judge righteously. And his comment was appropriate, because immediately afterwards Moses says to the judges, "you shall not pervert justice, you shall not show partiality, and you shall not take a bribe" (לֹא תַטֶּה מִשְׁפָּט לֹא תַכִּיר פָּנִים וְלֹא תִקַּח שֹׁחַד). However, the question arises: Why did Moses not discuss the judges or their qualifications at all? He should have said: "appoint for yourselves righteous and upright judges." Then, after their qualifications had been enumerated, it would have been appropriate to add "and they will render just judgment." Why did he leave this implicit rather than state it explicitly?
But it appeared to our master to explain that precisely by saying that they should appoint judges and officers, Moses was assuring them that the judges would render just judgment, because, in saying "appoint judges" he meant to say "but not a king." The topic of a king is only mentioned later when Moses says (Deuteronomy 17:14) "And you will say 'I set a king over me like all the nations round about me,'" which shows [because "and you will say" shows that the idea for a king comes from the people not from G-d, as in fact was the case at the time of Samuel] that the Eternal did not want this. Samuel the Ramati also responded bitterly when they said to him "Give us a king," because a king would not care about the will of the people and his heart would have no concern for them, but would just do as he pleased. And who would say to the king: "what are you doing?" Nor must a king follow the laws and statutes that govern the state. Rather he issues decrees right and left as his heart desires. Not so are the judges and officers appointed by the citizens of the state! For they do not rule forever, and their reign is not perpetual, but lasts only as long as the people wish them to rule. Nor do their children inherit their positions, as does the son of the king who succeeds his father and is coronated with or without the consent of the people. Judges are therefore obliged to render just and upright judgments according to the laws of the state. And that is why a judge and an officer are preferred by the Eternal to a king, a monarch, and a sovereign, and why Moses said "You shall appoint judges and officers," but not a king. In doing so, you can be certain that they will judge the nation justly, and that, unlike a king, they will not do what their hearts desire without protest.
כִּי תָבֹא אֶל הָאָרֶץ אֲשֶׁר ה"א נֹתֵן לָךְ וִירִשְׁתָּהּ וְיָשַׁבְתָּה בָּהּ וְאָמַרְתָּ אָשִׂימָה עָלַי מֶלֶךְ כְּכָל הַגּוֹיִם אֲשֶׁר סְבִיבֹתָי שׂוֹם תָּשִׂים עָלֶיךָ מֶלֶךְ אֲשֶׁר יִבְחַר ה"א בּוֹ מִקֶּרֶב אַחֶיךָ תָּשִׂים עָלֶיךָ מֶלֶךְ לֹא תוּכַל לָתֵת עָלֶיךָ אִישׁ נָכְרִי אֲשֶׁר לֹא אָחִיךָ הוּא
When you come to the land . . . and shall say, I will set a king over me . . . . You shall set him king over you, whom the Lord your G-d shall choose; one from among your brothers shall you set king over you; you may not set a stranger over you (Deuteronomy 17:14-15)
See the Ramban who was at pains to explain why Moses admonishes "you may not put a foreigner over you" after saying that the Eternal will Himself choose the king. If so, the decision about who shall be king is in the hand of G-d, and He will not choose a foreigner.
And it appeared to our master to explain that there was never a definite commandment from the Eternal to choose a king. It was only if the people would demand a king and would say "I would put a king over me" that they were permitted to institute a monarchy. And the reason that the Eternal did not choose a king, but only judges and officers, is that, as we wrote above, a judge stands under the rule of the people who chose him and by virtue of whose authority he became the head. It is therefore incumbent upon him to uphold righteousness and justice. However, a king chosen by the Eternal is elevated above the entire people whom he commands. And if so, he inevitably stands above the laws that are written in the Torah and he need not decide in accordance with those laws, but may decide according to his own discretion. For the king may break through fences and no one may resist him.
So should the people become unruly and depart from a moral path and should the judges, because they govern according to the precepts of the Torah and justice and righteousness, lack the power to restrain the people who will not be disciplined by these precepts, then it becomes imperative for them to install a king who, breaking any upraised arm, will impose law and order upon them and discipline them brutally for their transgressions. As the one chosen by the Eternal to stand in the breach, his fear and his awe will be upon them, for he will show no pity in meting out punishment and will do with them as he sees fit. Indeed, his authority over the people will be upheld only if they believe that the king, having been chosen by G-d to reign over them, need not conduct himself with them according to the Torah, whose ways are the ways of pleasantness. For his selection by G-d has raised him above them so that he may do whatever he likes with them. As a result, the people will be too intimidated to disobey the king, because he has the authority to punish them with cruelty and fury. This is the meaning of "you shall set over you him whom the Lord your G-d will choose" (שׂוֹם תָּשִׂים עָלֶיךָ מֶלֶךְ אֲשֶׁר יִבְחַר ה"א בּוֹ) from which the Sages deduced: Let fear of him be upon you. And how should it be upon you? Through your belief that the Lord your G-d has chosen him (שתהא אימתו עליך, ובמה שתאמין אֲשֶׁר יִבְחַר ה"א בּוֹ).
This is in contrast to the judges about whom it says "you shall appoint for yourself" (תִּתֶּן לְךָ), because they are selected by the people while the king is chosen by G-d by way of a prophet or the Urim and Thummim. Therefore "שׂוֹם תָּשִׂים" means that the fear of him should be upon you owing to your knowledge that the Eternal has chosen him, so that his power and his authority come from G-d and not from you.
Moses then goes on to warn them not to say that we will not ask G-d and His prophets to choose a king, but instead we will choose a king from another nation of whom, because he is a foreigner (אִישׁ נָכְרִי), we will be very fearful, who will administer punishment without pity. If we appoint a foreign king to discipline us, why do we need a king whom the Eternal will choose? Concerning such an idea, Moses says: "you may not do so, for one from among your brothers you shall set as king."
Afterwards, Moses gives a warning to the king and says (Deuteronomy 17:18): "and when he sits upon the throne of his kingdom," i.e., when, after having eliminated all the evil-doers from the land, his throne is stabilized and his reign secure, then he too should conduct himself uprightly to do justice and righteousness and "he shall write for himself in a book a copy of this law." And from that time, he should see what is written in the Torah and act accordingly "and he may not turn aside from the commandment either to the right or the left." For after he has smitten the wicked with the rod of his mouth and restored peace to his realm, he will no longer be obliged to act beyond the limits of the law (להוראת שעה).
תָּמִים תִּהְ' עִם ה' אֱלֹקֶיךָ
You shall be blameless before the Lord your G-d (Deuteronomy 18:13)
Rashi comments: walk before Him wholeheartedly, put your hope in Him and do not attempt to investigate the future, but whatever it may be that comes upon you accept it wholeheartedly, and then you shall be with Him and become His portion
The Ramban, however, explains that we should direct our hearts toward Him alone and we should seek after the future from His prophets, those who are beloved by Him, and from the Urim and Thummim. It seems that he inferred this from the verses below (Deuteronomy 18:15): "The Lord your G-d will raise up for you, a prophet like me from among you, from your brethren - to him shall you listen." This seems to suggest that we may seek after the future and ask what will happen to us, but may do so only from a prophet. However, Rashi interpreted this verse differently and understands "you shall be blameless" (תָּמִים תִּהְ') to mean that you shall not attempt to search the future at all. Only then can one be "blameless" with the Eternal.
Although the verses below (Deuteronomy 18:14-15): "כִּי הַגּוֹיִם הָאֵלֶּה וכו' אֶל מְעֹנְנִים וְאֶל קֹסְמִים יִשְׁמָעוּ וְאַתָּה וכו' נָבִיא מִקִּרְבְּךָ מֵאַחֶיךָ כָּמֹנִי יָקִים לְךָ וכו'" For these nations, which you shall possess, listened to soothsayers, and to diviners; but as for you, the Lord your G-d has not allowed you so to do. The Lord your G-d will raise to you a prophet from your midst, from your brothers, like me; to him you shall listen.
This verse contrasts the "soothsayers and diviners," who may not be consulted, with a prophet of G-d, who shall be heeded, as this prophet speaks in the name of the Eternal concerning one of the commandments. Thus, even if a prophet should, under some extraordinary circumstance (הוראת שעה), command you to act contrary to the law, as Elijah did at Mount Carmel, you must listen to him. And by saying that these nations give heed to soothsayers and to diviners, Moses meant that even though these nations have soothsayers and diviners who claim to be able to foretell the future, no knowledge of the future is brought to them except through their machinations of secret arts, magic and sorcery. Only then can they grasp, as did the magicians of Egypt and their ilk, some fragment of the future. However, we, the children of the living G-d, must have nothing to do with this. Rather, the Eternal will communicate to His prophets and they will tell us what we must know. But we may not search after the future. Thus, Moses said: "From this fact you can understand that the Eternal does not want you to search after the future. While the nations have soothsayers and diviners who perform their various machinations to grasp some fragment of the future, to you the Eternal has given prophets who will prophesy in His name when He confers His spirit upon them at the time of His desiring. But He has not empowered those prophets to perform any action by which they can bring prophecy down upon themselves. You therefore must be blameless with the Lord your G-d and listen only to the prophet who will speak to you in the name of the Eternal."
And the words of Rashi appear more reasonable than those of the Ramban, because it is written below (Deuteronomy 18:16-19):
"כְּכֹל אֲשֶׁר שָׁאַלְתָּ מֵעִם ה' אֱלֹקֶיךָ בְּחֹרֵב וכו', נָבִיא אָקִים לָהֶם וכו', וְנָתַתִּי דְבָרַי בְּפִיו וכו', וְהָיָה הָאִישׁ אֲשֶׁר לֹא יִשְׁמַע" Just as you desired of the Lord your G-d at Horeb on the day of the assembly, when you said: 'Let me not hear the voice of the Lord my G-d, or see this great fire any more, lest I die' . . . I will raise them up for them a prophet like you from among their brethren; and I will put My words in his mouth, and he shall speak to them all that I shall command them. And whoever will give heed unto My words which he shall speak in my name, I will require it of him.
From here it appears that the Scripture is speaking about a prophet of the law who is giving prophecy in the name of the Eternal that they should do this or do that, but not about a prophet who will reveal that which is hidden. For (Deuteronomy 29:29) "the secret things belong to the Lord our G-d; but the things that are revealed belong to us and to our children forever, that we may do all the words of this law." This means that whatever is revealed to us from the secret things is revealed only so that we may do our duty, and to warn the people what will befall them should they not take heed to fulfill the Torah.