Commenting on the Torah's charge "to be holy, since I the Lord your G-d am holy" (Vayikra, 19:2) the Ramban explains that it is not enough to keep the laws of the Torah. One can do so meticulously and still be a "scoundrel with the permission of the Torah."

Torah law gives us a framework for life, but one who so desires can technically stay within that framework while nonetheless violating the basic goals of the Torah. What we often call the spirit of the law—observing the intent of the law and not just its letter—is the mark of holiness. All too often, we are witness to a disconnect between ethics and law. Rav Yochanan  goes so far as to state that Jerusalem was destroyed because the people followed the laws of the Torah (Bava Metzia 30b). When the Gemara incredulously asks 'but is that not wonderful' the explanation given is they may have followed the laws of the Torah but they did no more, refusing to act lifnim meshurat hadin, beyond the call of duty.

However, there is one place where extra-legal considerations have no place: namely, in a court of law. The role of the judge is to faithfully apply the letter of law as "the law must pierce the mountain" (Sanhedrin 6b).

"Do not pervert justice. Do not give special consideration to the poor nor show respect to the great. In righteousness you shall judge your fellow" (Vayikra, 19:15). The Torah warns us not to play moral arbiter by undeservedly awarding judgment in favour of the poor or rich. One could argue, the rich have an obligation to support the poor, and purposely ruling in favour of the poor simply helps the rich to fulfill the mitzvah of tzedakah. Similarly, a judge may not unjustly rule in favour of a rich man, arguing that to do otherwise would embarrass a distinguished member of the community. Better to rule in his favour and not humiliate him, one might mistakenly suggest.

With this unflinching commitment to the law established, the Torah then finishes the verse with a seeming contradiction; "in righteousness you shall judge your fellow." Our Sages interpret this phrase as obligating one to judge all people favourably, giving them the benefit of the doubt wherever possible. While the first half of the verse commands that there is to be not even the slightest bias in judgment, the second half tells us to do exactly that.

The difference, of course, is in the context. The very same acts—of ensuring that the needs of the poor are taken care of, of not embarrassing our fellow man—that in the context of general society are great mitzvoth, in the context of a court of law become a perversion of justice. The same law that demands we judge our fellows favourably warns judges that "when the litigants stand before you, they shall be in your eyes as sinners" (Avot 1:8).

Ironically, a judge must at times conquer his desire to do that which is right, noble and ethical in favour of what the uncompromising law requires. Individual circumstances, which are so important in our daily interactions with others, must be ignored in the court of law. This requirement actually runs the risk of hardening judges to the plight of individuals, similar to the way that a doctor who sees pain, suffering and death on a daily basis runs the risk of losing empathy for the pain of others. While professionally one must separate one’s emotions from the tasks at hand, personally we may not. This is a balance that is often difficult to navigate. No wonder our Sages recommend that one should flee from being appointed a judge (Avot 4:9).

Perhaps this can add an additional insight into why the Sanhedrin, the highest court of land, is to be situated within the Temple confines (Rashi, Shemot 21:1). The Temple is the domain of the Kohanim, the descendants of Aharon, the lover and pursuer of peace. It is a place of forgiveness, of understanding of human frailties. Judges, who must professionally develop a tough exterior, focusing only on the law and being oblivious to the person in front of them, must be surrounded by those who embody caring for the people. The harshness of the judge and the tenderness of the priest must co-exist, side by side.