The #MeToo movement is jubilant over the guilty verdict against Bill Cosby for molesting Andrea Constand fifteen years ago. But guilty or not, Cosby is guaranteed a fair trial. That’s the bedrock idea of our legal system. He didn’t get one. Camille Cosby’s statement on Thursday condemning her husband’s trial as unfair is largely true.

Doing right by sexual assault victims is important, but it should not mean trashing cherished legal principles that protect all Americans — whatever their gender. A jury refused to convict Cosby in 2017, but in the retrial the prosecutor and judge changed the rules of evidence to get the job done. Kangaroos couldn’t have rigged it any better. The unfairness makes it likely the conviction will be overturned on appeal. Trying Cosby a third time — this time, fairly — will serve justice far more than allowing this tainted verdict to stand.

Constand, a Temple University athletic department administrator, claimed that when she visited the comedian at his mansion in 2004, he had offered her pills that made her feel drugged and then sexually groped her and penetrated her with his fingers. She waited a year to report the alleged assault and gave two different dates when it supposedly occurred. The District Attorney at that time refused to bring criminal charges.

A decade later Kevin Steele ran for Montgomery County D.A., tarring his opponent as “the former DA who refused to prosecute Bill Cosby.” Steele’s TV campaign ad implied that Cosby should be charged with sexual assault and the ad even showed photos of some of Cosby’s female accusers. Soon after winning the election, Steele charged the comedian. But who could expect a fair handling of the case from Steele?

The judge assigned to the case was Steven O’Neill, who is married to an advocate for sexual assault victims and coordinator of the Sexual Trauma Treatment Outreach and Prevention program at the University of Pennsylvania. He refused to recuse himself, insisting only that his wife is a “strong and independent person.” Her independence wasn’t the issue. His neutrality was.

Judge O’Neill allowed Cosby to be trapped into incriminating himself, in violation of the Sixth Amendment’s protection against having to testify against yourself. Way back in 2005, the D.A. at that time publicly announced he would not charge Cosby. By the D.A.’s own account, the announcement was designed to pressure Cosby into giving a deposition in a civil suit brought by Constand instead of pleading the Fifth Amendment. Cosby made damaging admissions about offering women pills to make them sexually compliant. Years later, Steele charged Cosby and got the deposition unsealed and read to the jurors — in essence allowing Cosby’s own admissions to be used against him.

Despite this biased set up, the first trial resulted in a hung jury in 2017. Evidence about what happened between Cosby and Constand that one night was sparse.

To fix that, at the 2018 retrial Judge O’Neill changed the rules of evidence, allowing a #MeToo pile on. At the first trial, O’Neill had ruled that testimony from numerous other women about Cosby’s “prior bad acts” — complaints going back decades — were not admissible because it would lead to unfair “prejudice to the Defendant.” Only one former accuser was permitted to testify. Cosby wasn’t on trial for the life he led, only for what he did on one day with Constand. Pennsylvania law bars introducing evidence to show a defendant has a propensity to commit a certain type of crime.

At the retrial O’Neill pulled a switch and worse, refused to explain why. He allowed the prosecutor to parade a string of women who had nothing to testify about the Cosby-Constand encounter but claimed Cosby has drugged and abused them in similar ways many years before. Cosby’s lawyers will challenge O’Neil’s unexplained admission of this testimony to appeal the verdict.

In another Pennsylvania sex abuse case, a conviction against a Roman Catholic church official was overturned on appeal because evidence about prior acts was deemed to have prejudiced the jury against the defendant.

In the court of public opinion, there is little doubt Cosby behaved viciously toward women, not at all in the character of his TV role as America’s Dad. He will live his final years in disgrace, no matter what happens on appeal. But the stakes are far higher than Cosby’s fate. Rigorous standards of proof and impartiality were sacrificed just to win a guilty verdict against Cosby. The system is supposed to be tilted in favor of the defendant. That shouldn’t be changed in sexual assault cases, just to ensure that sexual victims are vindicated. If that happens, we all lose.