The Supreme Court of Pennsylvania is weighing whether to uphold Bill Cosby's conviction or toss it out on appeal. If it is overturned, the 83-year-old comedian, who has served two years of a three-to-10-year sentence in a maximum security state prison, could be released.

Really? After being accused of sexual assault by dozens of women? Can there be any doubt of Cosby's guilt in any reasonable person's mind when so many women have come forward?

Cosby was tried and convicted in 2018 on charges of drugging and sexually assaulting just one woman — a 30-year-old college sports administrator named Andrea Constand. But virtually everyone in America was aware that she was, in a sense, a stand-in for a much broader group of alleged victims. In fact, some 60 women have now come forward to accuse him.

To most of us non-lawyers, that number alone is powerful evidence of Cosby's guilt. Common sense says that if one person accuses him, it's a classic he-said, she-said. But if 60 people accuse him, it seems unlikely they're all lying.

But the law sees this very differently.

So much so that, in the absence of extenuating circumstances, a trial court judge in a sexual assault case would generally refuse to allow the testimony of additional accusers other than the one the defendant was charged with attacking. As a result, the jury would never learn that there were multiple accusers or consider their accounts.

And that's the issue at the heart of Cosby's appeal. The lower court judge who oversaw the 2018 trial, Steven T. O'Neill, allowed five additional accusers to testify about their experiences, even though Cosby was charged with assaulting only Constand. Cosby's lawyers say the women's testimony should not have been permitted and the conviction should be thrown out.

Oral arguments were heard by the Pennsylvania Supreme Court earlier this month.

The issues in this case matter. The question of who should be allowed to testify about "prior bad acts" in a sexual assault case is one that comes up all the time, and can make the difference in whether a perpetrator is acquitted or convicted. It was an issue at Harvey Weinstein's trial and in Michael Jackson's molestation case — and in thousands of cases you've never heard of where prosecutors are trying to show a pattern of criminal behavior.

In the Cosby case, prosecutors have made a compelling case for why the judge was correct in allowing the additional testimony. But it's not an easy call.

The prohibition on allowing evidence about prior bad acts — a prohibition that goes back three centuries in English law — is based on the principle that the defendant is on trial only for the crime charged. Allowing other allegations can deny defendants the "presumption of innocence" to which they are entitled. Testimony suggesting a defendant has the "character" of a criminal or a "propensity" to commit crimes is prejudicial and can distract focus from the facts of a case.

These concerns date to the days of the Star Chamber, the notorious English court established in the 15th century and known for its lack of due process and arbitrary use of power. Almost any kind of character evidence was admissible.

Today, except under certain circumstances, evidence about "prior bad acts" is inadmissible.

Still, here's why Judge O'Neill was right to allow the testimony.

The rule barring "prior bad acts" evidence is not absolute. Often, there are competing interests to be balanced. In deciding whether to make an exception and admit it, the judge must weigh its "probative" value — its value in helping prove the crime — against the "prejudicial" effect of letting it in.

In this case, the most persuasive argument for allowing the testimony is the striking similarity of the women's accusations. As the prosecutors noted, the women's testimony showed a pattern of behavior involving crimes "so related to each other that proof of one tends to prove the other" and "so nearly identical as to become the signature of the same perpetrator."

Constand said Cosby urged her to take three blue pills, leaving her physically limp and unable to move as he touched her and penetrated her. Janice Baker-Kinney said Cosby gave her two Quaaludes and that she was unable to move as he fondled her; she passed out and then woke up naked in his bed the next morning. Janice Dickinson said she took a small blue pill at his suggestion and was unable to move when he climbed on top of her and raped her. Chelan Lasha said Cosby told her the blue pill he gave her was an antihistamine; she too was unable to move while he assaulted her.

Baker-Kinney, Dickinson and Lasha were among those who testified.

Other similarities include the age of the women, the mentoring relationship he established with them, the way they say he gave them the intoxicants and the settings in which he allegedly carried out the assaults.

Cosby's lawyers disagree. They say the testimony involved decades-old accusations that have not been charged as crimes and which are not nearly similar enough to meet legal standards.

But that's not persuasive.

In recent years, courts have been allowing more leeway on "prior bad acts" testimony in sexual assault cases. That's the result in part of the MeToo movement, which has pushed to give prosecutors tools to make stronger cases.

Balancing competing interests is complicated. We obviously want a judicial system in which criminal defendants are protected from extraneous character attacks or prejudicial insinuations about long-ago behavior.

But showing a pattern of behavior by a sexual predator is not extraneous or irrelevant. It is often the evidence that can turn what would otherwise be a hamstrung he-said, she-said into a clear case of wrongdoing, so that serial perpetrators can be held to account for their actions.

Nicholas Goldberg is an associate editor and op-ed columnist for the Los Angeles Times.