Resh Lakish said: Anyone who appoints a judge who is not fit, it is as though he planted an asherah, as it is said, "Judges and officers" (Deuteronomy 16:18), and adjacent to it, "You shall not plant for yourself an asherah" (Deuteronomy 16:21). And in a place where there is a Torah scholar, it is as though he planted it beside the altar, for it says "the LORD your God," and it says "You shall not make with Me... gods of silver and gods of gold" (Exodus 20:20). This teaches that one should not make even one of wood; rather it permits a god that comes for the sake of silver and for the sake of gold, that is, one appointed for money. (Exodus 20:21) (this is written at remez 373 and at remez 455).
An Unfit Judge Compared to a Planted Asherah
Yalkut Shimoni on Torah 303:3
אָמַר רֵישׁ לָקִישׁ, כָּל הַמַּעֲמִיד דַיָּין שֶׁאֵינוֹ הָגוּן, כְּאִלּוּ נָטַע אֲשֵׁרָה, שֶׁנֶּאֱמַר "שֹׁפְטִים וְשֹׁטְרִים" וּסְמִיךְ לֵיהּ "לֹא תִטַּע לְךָ אֲשֵׁרָה", וּבְמָקוֹם שֶׁיֵּשׁ תַּלְמִיד חָכָם כְּאִלּוּ בְּנָאוֹ אֵצֶל מִזְבַּח, "ה' אֱלֹהֶיךָ", וְאוֹמֵר לֹא תַעֲשׂוּן אִתִּי וְגוֹ' אֱלֹהֵי כֶסֶף וֵאלֹהֵי זָהָב, הוּא דְּלָא לֵעֲבִיד הָא דְּעֵץ שָׁרֵי, אֶלָּא אֱלוֹהַ הַבָּא בִּשְׁבִיל כֶּסֶף וּבִשְׁבִיל זָהָב. (שמות כ כא) (כָּתוּב בְּרֶמֶז שע"ג וּבְרֶמֶז תנ"ה).