לֹא תִטַּע לְךָ אֲשֵׁרָה כָּל עֵץ אֵצֶל מִזְבַּח יְהֹוָה אֱלֹהֶיךָ
You shall not plant for yourself an asherah, [or] any tree, near the altar of the Lord, your God.
Rabbi Akiva Eiger, in his commentary on the Shulchan Aruch, adds that the prohibition of not planting trees was extended by the Rabbis to include even the courtyard or backyard of our synagogues. The Rambam in his introduction to Mishna Torah, where he enumerates the Mitzvot, equates the Kedusha of a Beis HaKnesses with that of the Beis HaMikdash (Mitzvas Lo Sa’aseh number 65). Whatever was forbidden to be done in the Beis HaMikdash is Biblically forbidden to be done in the Beis HaKnesses. Seemingly, the Rambam’s position is even more stringent than that of R’ Akiva Eiger, who only prohibits tree planting as Rabbinic.
In the responsa Meishiv Davar of the Netziv, we find a dissenting opinion – that it is not forbidden to plant a tree in the synagogue area. Indeed, in the town of Brisk, trees were planted in the yard of the Beis Knesses and no one protested. Whereas the Torah prohibits planting trees in the Beis HaMikdash area, this prohibition did not extend to the Beis HaKnesses. The Kedusha of the Beis Hamikdash applied not only to the structural edifice but also to the makom, the place or ground it was standing on, as well as the surrounding area. While the Rambam equates the Beis HaMikdash with the Beis HaKnesses, this applies only to the Kedushas HaBinyan, the building itself, and perhaps the Kedushas Makom, the ground it was standing on, but not to the surrounding yard area. Consequently, it would be prohibited to plant a tree in the ground of the sanctuary of the Beis HaKnesses, but it is permissible in the yard area. (Halachic Positions, Vol. 5, pp. 47-48, Harrerei Kedem, Vol. 2, pp. 271-272).
Resh Lakish said: He who appoints an incompetent judge over the community is as though he had planted an asherah in Israel, for it is written: You shall set up judges and law enforcement officials for yourself in all your cities (Deut. 16:18), and soon after it is written You shall not plant for yourself an asherah, [or] any tree, near the altar of the Lord (Deut. 16:21) (Sanhedrin 7b).
Rav Chaim Brisker commented that an incompetent judge is compared specifically to an asherah because idolatrous shrines are generally identifiable. The asherah, however, appears as an ordinary tree. Outwardly, it is beautiful and luxuriant, but its essence is rotten (idolatrous). So, too, is a judge who outwardly appears qualified but inwardly is incompetent.
The Rav explained that one who judges righteously is given extraordinary authority to act in lieu of the Divine Judge. For in reality, no human being is capable or has the right to decide the fate of another, for he never knows the absolute truth. A dayan is called “elohim,” because of necessity he is granted a Divine prerogative. Consequently, if a human judge is incompetent, he in effect usurps Divine authority and desecrates it—that is akin to idolatry. Figuratively, he has planted an idolatrous shrine in the very place which was imbued with Divine Justice—near the altar of the Holy Temple.
This opinion of Resh Lakish, according to the Rambam (Hil. Sanhedrin 3:8), constitutes a Biblical prohibition and is not an asmachta (a scriptural text used as support for a rabbinical enactment). The source of the Rambam’s pesak is Yonasan ben Uziel (Deut. 16:21, 22). (Insights, pp. 72-73)