"You shall not do injustice in judgment" (Leviticus 19:15). This teaches that a judge who corrupts judgment is called "unjust," and he brings about [five things]: he defiles the land, and he banishes the Shekhinah, and he profanes the Name, and he makes Israel fall by the sword, and he exiles them from their land.
The Corrupt Judge Who Defiles the Land and Exiles Israel
Midrash Aggadah, Leviticus 19:15
לא תעשו עול במשפט. מלמד שהדיין המקלל את הדין נקרא עול, וגורם [לחמשה דברים] לטמא את הארץ, ומסלק את השכינה, ומחלל את השם, ומפיל את ישראל בחרב, ומגלה אותם מארצם: