A New York state appeals court has ruled disgraced rapist Harvey Weinstein is entitled to a new trial, but that doesn’t mean the former movie mogul is getting out of prison anytime soon.

In a shocking ruling Thursday morning, the New York State Court of Appeals overturned Weinstein’s 2020 rape conviction, which came several years after the 2017 #MeToo movement that started in part with accusations against the producer by many of Hollywood’s A-list female celebrities. Justices rebuked a lower court’s decision to allow some witnesses with no connection to the trial to provide horrific stories about their experiences with Weinstein behind closed doors.

“We conclude that the trial court erroneously admitted testimony of uncharged, alleged prior sexual acts against persons other than the complainants of the underlying crimes,” the court’s 4-3 decision said according to the AP. “The remedy for these egregious errors is a new trial.”

The court’s majority said, “It is an abuse of judicial discretion to permit untested allegations of nothing more than bad behavior that destroys a defendant’s character but sheds no light on their credibility as related to the criminal charges lodged against them.”

The narrow victory for Weinstein was condemned by Judge Madeline Singas, who wrote in her dissent that the majority of her colleagues were “whitewashing the facts to conform to a he-said/she-said narrative” and contributing to a “disturbing trend of overturning juries’ guilty verdicts in cases involving sexual violence.”

“The majority’s determination perpetuates outdated notions of sexual violence and allows predators to escape accountability,” Singas wrote.

Weinstein, 72, was less than four years into serving a 23-year sentence after being found guilty of criminal sex acts including forced oral sex on a TV and film assistant in 2006 and third-degree rape of an up-and-coming actress in 2013. He will remain behind bars due to a separate Los Angeles conviction in 2022 which added 16 years to his sentence after being found guilty of another rape. He was acquitted in a third trial.

The decision is a devastating setback for women’s rights activists who made great strides in the workplace after coming forward to share their experiences involving everything from sexual predation to verbal harassment. Former comedian Bill Cosby, who was sentenced to 10 years for rape during a 2018 trial, was released after just three years, and the U.S. Supreme Court declined to hear an appeal from a Pennsylvania court to throw out his conviction, limiting the legal landscape for sexual assault convictions.

Weinstein, once a powerful and feared presence in Hollywood behind memorable movies including “Pulp Fiction” and “Shakespeare in Love,” remains incarcerated in New York at the Mohawk Correctional Facility, about 100 miles (160 kilometers) northwest of Albany.