Do not pervert the judgment of one who is destitute (Exodus 23:6)
Mitzvah #79 discusses a person who is poor in the financial sense; there our natural inclination would be to assist him even if he is not objectively in the right. This mitzvah addresses one who is “poor” in that he lacks merits. Here, our inclination might be to see that he gets his comeuppance. However, if he is in the right in this lawsuit, we may not hold his general rottenness against him in order to make him lose. (Not only that, we’re not even allowed to show inequity in the way we address the two litigants. We must treat them equally, even if we consider one of them to be a bum.)
The reason for this mitzvah is to protect the integrity of the legal system. The judge may want to fix things so that the bad guy pays for at least some of his misdeeds, but that’s not the judge’s place. His job is to decide the case in front of him on the basis of the facts. God will judge the man on the basis of his life in the big picture.
This mitzvah is discussed in the Midrash in the Mechilta. It is codified in Choshen Mishpat 17. It is #278 of the 365 negative mitzvos in the Rambam’s Sefer HaMitzvos and #67 of the 194 negative mitzvos that can be fulfilled today as listed in the Chofetz Chaim’s Sefer HaMitzvos HaKatzar. This mitzvah applies in every time and place; the Sefer HaChinuch it only applies to men, who serve as judges in court cases, though the Chofetz Chaim says it applies equally to both men and women.