After serving more than three years of a possible 10-year sentence in a maximum-security facility outside of Philadelphia, the legendary comedian Bill Cosby had his sexual assault conviction overturned on Wednesday afternoon.

In a 79-page opinion, the judges of Pennsylvania’s highest court ruled that the “non-prosecution agreement” that was struck with the previous prosecutor should have protected Cosby from any criminal charge, the Associated Press reports.

The decision stated that District Attorney Kevin Steele, who decided to arrest Cosby, was under an obligation to stand by his predecessor’s promise not to charge Cosby. There was no evidence, however, that any agreement was ever put in writing.

Furthermore, the court also ruled that the conviction was based on "tainted" testimony and barred a retrial of the case.

“When an unconditional charging decision is made publicly and with the intent to induce action and reliance by the defendant, and when the defendant does so to his detriment (and in some instances upon the advice of counsel), denying the defendant the benefit of that decision is an affront to fundamental fairness, particularly when it results in a criminal prosecution that was foregone for more than a decade,” the appeals ruling stated.

“For these reasons, Cosby’s convictions and judgment of sentence are vacated, and he is discharged,” the ruling concluded.

Brian Perry, one of Cosby’s attorneys, praised the court’s ruling in favor of his client.

“We are thrilled with the Supreme Court’s decision,” he said. “To be honest with you, we all believed, collectively, that this is how the case would end. We did not think he was treated fairly and fortunately, the Supreme Court agreed.”

“FINALLY!!!! A terrible wrong is being righted—a miscarriage of justice is corrected!′ Phylicia Rashad, his co-star in the Cosby Show tweeted in celebration of the news.

But not everyone was excited about Cosby’s release. Advocates for women who have been sexually abused viewed the decision as a stunning turn of events.

“I am furious to hear this news,” actor Amber Tamblyn, a founder of Time’s Up, wrote on Twitter.

“I personally know women who this man drugged and raped while unconscious. Shame on the court and this decision,” she continued.

In the 1980s, Cosby became known as “America’s Dad,” for his role as Dr. Heathcliff Huxtable in the Cosby Show, one of the most iconic sitcoms of all time. Running for eight successful seasons, the show was a game-changer for Black sitcoms.

As EBONY previously reported, Cosby was found guilty of drugging and violating Andrea Constand, a Temple University sports administrator at his home in the suburbs of Philadelphia in 2004. Upon his conviction, Cosby was labeled a “sexually violent
predator” and will be registered as a sex offender for the rest of his life. Though he vehemently maintained his innocence, dozens of women accused him of sexual assault. He became the first celebrity tried and convicted in the #MeToo era.