Pennsylvania prosecutors asked the U.S. Supreme Court on Monday to overturn a lower court's ruling that reversed Bill Cosby's conviction for sexual assault.

Cosby, 84, who was often dubbed "America's Dad" before allegations of sexual misconduct were made public, had served more than two years of a 10-year sentence when the state's highest court tossed the conviction in June, saying an agreement between Cosby and former Montgomery County prosecutor Bruce Castor prevented Cosby from being charged in the case.

Castor's successors argued that such a ruling could set a dangerous precedent if convictions are overturned due to closed-door deals. The only written evidence of such a promise is a 2005 press release from Castor, who said he did not have enough evidence to arrest Cosby.

PLAYBOY MODEL VICTORIA VALENTINO ON SPEAKING OUT AGAINST BILL COSBY: 'IT WAS ABSOLUTELY LIBERATING’

Bill Cosby arrives for his sentencing hearing at the Montgomery County Courthouse on Sept. 24, 2018, in Norristown, Pa. Prosecutors asked the U.S. Supreme Court to review the decision that overturned Cosby’s conviction. (AP Photo/Matt Slocum, File)

"This decision as it stands will have far-reaching negative consequences beyond Montgomery County and Pennsylvania. The U.S. Supreme Court can right what we believe is a grievous wrong," Montgomery County District Attorney Kevin Steele wrote in a petition to the high court.

Cosby’s lawyers have long argued that he relied on a promise that he would never be charged when he gave damaging testimony in an accuser’s civil suit in 2006.

The admissions were later used against him in two criminal trials. Cosby was arrested in 2015 just days before the 12-year statute of limitations expired following new evidence from his deposition from a lawsuit after he was accused of drugging and molesting a Temple University employee at his home. 

In the June 30 ruling that freed Cosby, the Pennsylvania Supreme Court said Cosby's arrest was an "affront to fundamental fairness."

This June 30, 2021, file photo shows Bill Cosby gesturing outside his home in Elkins Park, Pa., after being released from prison. Prosecutors asked the U.S. Supreme Court to review the decision that overturned Cosby’s conviction. (AP Photo/Matt Rourke, File)

Weeks later, the ruling prompted the state attorney general to dismiss charges against a jail guard accused of sexually abusing female inmates, because of an earlier agreement with county prosecutors that let him resign rather than face charges.

Prosecutors said Castor's promise fell short of a lifetime immunity agreement and raised doubts that he ever made such a deal. Defense lawyers said the case against Cosby should have never gone to trial because of the agreement.

Castor later went on to represent President Donald Trump in his second impeachment trial. He said he made the promise to a now-dead defense lawyer for Cosby, and got nothing in return.

He never mentioned it to top assistant Risa Ferman, who led his Cosby investigation. She later became district attorney, and reopened the case in 2015 after a federal judge unsealed Cosby's deposition.

Cosby was the first celebrity tried in the #MeToo era. He came to prominence as a groundbreaking Black actor and comedian and reached his peak in the 1980s when he starred on the "Cosby Show." 

His image was destroyed after a slew of sexual assault allegations that led to multiple court settlements and criminal charges. 

Comedian Bill Cosby, center, and spokesperson Andrew Wyatt, right, approach members of the media gathered outside Cosby's home in Elkins Park, Pa., on June 30, 2021, after Pennsylvania's highest court overturned his sex assault conviction. (AP Photo/Matt Rourke)

CLICK HERE TO GET THE FOX NEWS APP

Even before the allegations, he fell out of favor with some for lecturing the Black community about family values. 

The likelihood of the petition's success is unclear. 

Two justices on the court, Clarence Thomas and Brett Kavanaugh, were accused of sexual misconduct during their bitterly-fought confirmation hearings.

The Associated Press contributed to this report.