Separation of Powers
The King
(יד) כִּֽי־תָבֹ֣א אֶל־הָאָ֗רֶץ אֲשֶׁ֨ר ה' אֱלֹהֶ֙יךָ֙ נֹתֵ֣ן לָ֔ךְ וִֽירִשְׁתָּ֖הּ וְיָשַׁ֣בְתָּה בָּ֑הּ וְאָמַרְתָּ֗ אָשִׂ֤ימָה עָלַי֙ מֶ֔לֶךְ כְּכָל־הַגּוֹיִ֖ם אֲשֶׁ֥ר סְבִיבֹתָֽי׃ (טו) שׂ֣וֹם תָּשִׂ֤ים עָלֶ֙יךָ֙ מֶ֔לֶךְ אֲשֶׁ֥ר יִבְחַ֛ר ה' אֱלֹהֶ֖יךָ בּ֑וֹ מִקֶּ֣רֶב אַחֶ֗יךָ תָּשִׂ֤ים עָלֶ֙יךָ֙ מֶ֔לֶךְ לֹ֣א תוּכַ֗ל לָתֵ֤ת עָלֶ֙יךָ֙ אִ֣ישׁ נָכְרִ֔י אֲשֶׁ֥ר לֹֽא־אָחִ֖יךָ הֽוּא׃ (טז) רַק֮ לֹא־יַרְבֶּה־לּ֣וֹ סוּסִים֒ וְלֹֽא־יָשִׁ֤יב אֶת־הָעָם֙ מִצְרַ֔יְמָה לְמַ֖עַן הַרְבּ֣וֹת ס֑וּס וַֽה' אָמַ֣ר לָכֶ֔ם לֹ֣א תֹסִפ֗וּן לָשׁ֛וּב בַּדֶּ֥רֶךְ הַזֶּ֖ה עֽוֹד׃ (יז) וְלֹ֤א יַרְבֶּה־לּוֹ֙ נָשִׁ֔ים וְלֹ֥א יָס֖וּר לְבָב֑וֹ וְכֶ֣סֶף וְזָהָ֔ב לֹ֥א יַרְבֶּה־לּ֖וֹ מְאֹֽד׃ (יח) וְהָיָ֣ה כְשִׁבְתּ֔וֹ עַ֖ל כִּסֵּ֣א מַמְלַכְתּ֑וֹ וְכָ֨תַב ל֜וֹ אֶת־מִשְׁנֵ֨ה הַתּוֹרָ֤ה הַזֹּאת֙ עַל־סֵ֔פֶר מִלִּפְנֵ֥י הַכֹּהֲנִ֖ים הַלְוִיִּֽם׃ (יט) וְהָיְתָ֣ה עִמּ֔וֹ וְקָ֥רָא ב֖וֹ כָּל־יְמֵ֣י חַיָּ֑יו לְמַ֣עַן יִלְמַ֗ד לְיִרְאָה֙ אֶת־ה' אֱלֹהָ֔יו לִ֠שְׁמֹר אֶֽת־כָּל־דִּבְרֵ֞י הַתּוֹרָ֥ה הַזֹּ֛את וְאֶת־הַחֻקִּ֥ים הָאֵ֖לֶּה לַעֲשֹׂתָֽם׃ (כ) לְבִלְתִּ֤י רוּם־לְבָבוֹ֙ מֵֽאֶחָ֔יו וּלְבִלְתִּ֛י ס֥וּר מִן־הַמִּצְוָ֖ה יָמִ֣ין וּשְׂמֹ֑אול לְמַעַן֩ יַאֲרִ֨יךְ יָמִ֧ים עַל־מַמְלַכְתּ֛וֹ ה֥וּא וּבָנָ֖יו בְּקֶ֥רֶב יִשְׂרָאֵֽל׃ (ס)
(14) When thou art come unto the land which the LORD thy God giveth thee, and shalt possess it, and shalt dwell therein; and shalt say: ‘I will set a king over me, like all the nations that are round about me’; (15) thou shalt in any wise set him king over thee, whom the LORD thy God shall choose; one from among thy brethren shalt thou set king over thee; thou mayest not put a foreigner over thee, who is not thy brother. (16) Only he shall not multiply horses to himself, nor cause the people to return to Egypt, to the end that he should multiply horses; forasmuch as the LORD hath said unto you: ‘Ye shall henceforth return no more that way.’ (17) Neither shall he multiply wives to himself, that his heart turn not away; neither shall he greatly multiply to himself silver and gold. (18) And it shall be, when he sitteth upon the throne of his kingdom, that he shall write him a copy of this law in a book, out of that which is before the priests the Levites. (19) And it shall be with him, and he shall read therein all the days of his life; that he may learn to fear the LORD his God, to keep all the words of this law and these statutes, to do them; (20) that his heart be not lifted up above his brethren, and that he turn not aside from the commandment, to the right hand, or to the left; to the end that he may prolong his days in his kingdom, he and his children, in the midst of Israel.
Sanhedrin 19

המלך לא דן ולא דנין אותו, לא מעיד ולא מעידין אותו

אלא מלכי ישראל מ"ט לא

משום מעשה שהיה דעבדיה דינאי מלכא קטל נפשא

אמר להו שמעון בן שטח לחכמים תנו עיניכם בו ונדוננו

שלחו ליה עבדך קטל נפשא שדריה להו שלחו לי' תא אנת נמי להכא (שמות כא, כט) והועד בבעליו אמרה תורה יבא בעל השור ויעמוד על שורו

אתא ויתיב א"ל שמעון בן שטח ינאי המלך עמוד על רגליך ויעידו בך ולא לפנינו אתה עומד אלא לפני מי שאמר והיה העולם אתה עומד שנאמר (דברים יט, יז) ועמדו שני האנשים אשר להם הריב וגו'

אמר לו לא כשתאמר אתה אלא כמה שיאמרו חבריך

נפנה לימינו כבשו פניהם בקרקע נפנה לשמאלו וכבשו פניהם בקרקע

אמר להן שמעון בן שטח בעלי מחשבות אתם יבא בעל מחשבות ויפרע מכם

מיד בא גבריאל וחבטן בקרקע ומתו

באותה שעה אמרו מלך לא דן ולא דנין אותו לא מעיד ולא מעידין אותו

[Mishnah] A King is not judged, nor does he serve as judge. He does not give testimony, nor does he testify.

[Gemara] Why isn't a king judged?

Because of an incident that occurred when King Yannai's servant killed someone.

Shimon Ben Shetach said to his fellow sages, pay attention to this matter and let us adjudicate!

They send Yannai a message, "Your servant has killed someone. Come before us here and testify as the Torah commands."

Yannai came and said before them. Shimon Ben Shetach said to him, "Yannai the King, stand on your feet and give testimony. And it is not before us that you that, but rather before the One who spoke and created the world, you stand.

Yannai replied, "I will not do as you say, but rather as your fellow judges command."

Shimon ben Shetach turned to his right, and the judges cast their eyes to the ground. He turned to his left, and those judges cast their eyes to the ground as well.

Shimon ben Shetach said to them, "Deep thinkers you all must be! Let the Master of Thoughts come and punish you."

Immediately, Gabriel came, struck them down, and they died.

At that moment, they declared, "A king is not judged, nor does he serve as judge. Does not testify, nor is he testified against."