Another interpretation of "righteous judgment" (Deuteronomy 16:18): At the time when they judge with righteousness, they perform an act of righteousness with creatures, as it is said, "Truth shall spring up from the earth, and righteousness shall look down from heaven" (Psalms 85:12). At the time when a judgment of truth springs up from the earth, the Holy One, blessed be He, performs an act of righteousness with creatures, and delivers them from calamity and from afflictions, and good comes into the world.
Righteous Judgment Brings Down Heaven's Mercy in Shoftim
Midrash Tanchuma Buber, Shoftim 5:2
ד"א משפט צדק. בזמן שדנין צדק, עושין צדקה עם הבריות, שנאמר אמת מארץ תצמח וצדק משמים נשקף (תהלים כה יב), בזמן שדין אמת מארץ תצמח, הקב"ה עושה צדקה עם הבריות, ומציל אותם מפורענות, ומיסורין, וטובה באה לעולם.