8כָּל סַנְהֶדְרִין אוֹ מֶלֶךְ אוֹ רֹאשׁ גּוֹלָה שֶׁהֶעֱמִידוּ לָהֶן לְיִשְׂרָאֵל דַּיָּן שֶׁאֵינוֹ הָגוּן וְאֵינוֹ חָכָם בְּחָכְמַת הַתּוֹרָה וְרָאוּי לִהְיוֹת דַּיָּן. אַף עַל פִּי שֶׁהוּא כֻּלּוֹ מַחֲמַדִּים וְיֵשׁ בּוֹ טוֹבוֹת אֲחֵרוֹת הֲרֵי זֶה שֶׁהֶעֱמִידוֹ עוֹבֵר בְּלֹא תַּעֲשֶׂה. שֶׁנֶּאֱמַר לֹא תַכִּירוּ פָנִים בַּמִּשְׁפָּט. מִפִּי הַשְּׁמוּעָה לָמְדוּ שֶׁזֶּה מְדַבֵּר כְּנֶגֶד הַמְמֻנֶּה לְהוֹשִׁיב דַּיָּנִין. אָמְרוּ חֲכָמִים שֶׁמָּא תֹּאמַר אִישׁ פְּלוֹנִי נָאֶה אוֹשִׁיבֶנּוּ דַּיָּן. אִישׁ פְּלוֹנִי גִּבּוֹר אוֹשִׁיבֶנּוּ דַּיָּן. אִישׁ פְּלוֹנִי קְרוֹבִי אוֹשִׁיבֶנּוּ דַּיָּן. אִישׁ פְּלוֹנִי יוֹדֵעַ בְּכָל לָשׁוֹן אוֹשִׁיבֶנּוּ דַּיָּן. נִמְצָא מְזַכֶּה אֶת הַחַיָּב וּמְחַיֵּב אֶת הַזַּכַּאי לֹא מִפְּנֵי שֶׁהוּא רָשָׁע אֶלָּא מִפְּנֵי שֶׁאֵינוֹ יוֹדֵעַ. לְכָךְ נֶאֱמַר (דברים א יז) "לֹא תַכִּירוּ פָנִים בַּמִּשְׁפָּט". וְעוֹד אָמְרוּ כָּל הַמַּעֲמִיד לְיִשְׂרָאֵל דַּיָּן שֶׁאֵינוֹ הָגוּן כְּאִלּוּ הֵקִים מַצֵּבָה שֶׁנֶּאֱמַר (דברים טז כב) "וְלֹא תָקִים לְךָ מַצֵּבָה אֲשֶׁר שָׂנֵא ה' אֱלֹהֶיךָ". וּבִמְקוֹם תַּלְמִידֵי חֲכָמִים כְּאִלּוּ נָטַע אֲשֵׁרָה שֶׁנֶּאֱמַר (דברים טז כא) "לֹא תִטַּע לְךָ אֲשֵׁרָה כָּל עֵץ אֵצֶל מִזְבַּח ה' אֱלֹהֶיךָ". וְכֵן אָמְרוּ חֲכָמִים (שמות כ כ) "לֹא תַעֲשׂוּן אִתִּי אֱלֹהֵי כֶסֶף" אֱלוֹהַּ הַבָּא בִּשְׁבִיל כֶּסֶף וְזָהָב זֶה הַדַּיָּן שֶׁמִּנּוּהוּ מִפְּנֵי עָשְׁרוֹ בִּלְבַד:
Whenever a Sanhedrin, a king, or an exilarch appoints a judge who is not fitting and/or is not learned in the wisdom of the Torah and is not suitable to be a judge - even if he is entirely a delight and possesses other positive qualities - the person who appoints him violates a negative commandment, as Deuteronomy 1:17 states: "Do not show favoritism in judgment." According to the Oral Tradition, we learned that this command is addressed to those who appoint judges. Our Sages declare: "Perhaps a person will say: 'So and so is attractive, I will appoint him as a judge,' 'So and so is strong, I will appoint him as a judge,' 'So and so is my relative, I will appoint him as a judge,' or "So and so knows all the languages, I will appoint him as a judge.' This will lead to those who are liable being vindicated and those who should be vindicated held liable, not because the judge is wicked, but because he does not know Torah law. Therefore the Torah states: "Do not show favoritism in judgment." Our Sages also declare: "Whoever appoints a judge who is not appropriate for the Jewish people is considered as if he erected a monument, as implied by Deuteronomy 16:22: "Do not erect a monument which is hated by G-d, your Lord." If he is appointed instead of a Torah scholar, it is as if one planted an asherah, as Ibid.:21 states: "Do not plant an asherah or any other tree next to G-d's altar." And our Sages interpreted Exodus 20:20: "Do not make gods of silver and gods of gold together with Me" to mean "Do not appoint a judge because of silver and gold." This refers to a judge who was appointed because of his wealth alone.