The directive to create a judicial system is set out in Deuteronomy 16:18-20. God commands the Israelites to appoint judges and law enforcement officials in all their cities and towns. These judges are instructed to judge the people with “righteous judgment,” an idea that is defined in the following verse:
“You shall not pervert justice; you shall not show favoritism, and you shall not take a bribe, for bribery blinds the eyes of the wise and perverts just words.”
The true goal behind a righteous justice system is not just that the laws be enforced, but that justice be upheld. This heavy responsibility devolves upon the judges. Therefore a judge, ideally, must have enough self-knowledge to ensure impartiality.
Monetary bribery is an obvious perversion of justice. But a person may be swayed by a vast array of other factors: flattery, class status, etc. Indeed, even the personal appearance or comeliness of a litigant can affect a judge's sentiment if the judge is not careful.
For this reason, the Torah demands, “Justice, justice shall you pursue” (Deut. 16:20). A judge must make decisions with extreme care. Once the case is heard, the judge must evaluate if any external factors have affected the judgment and if a truly just decision is being rendered.
So numerous are the pitfalls of being a judge that Rabbi Ishmael declared, “He who shuns the office of judge rids himself of enmity, theft, and false swearing. He who presumptuously rules in Torah matters is foolish, wicked, and arrogant” (Ethics of the Fathers 4:9).