PHILADELPHIA (AP) - Prosecutors urged the U.S. Supreme Court to reinstate Bill Cosby's sexual assault conviction, complaining in a petition released Monday the verdict was thrown out over a questionable agreement that the comic claimed gave him lifetime immunity.

They said the Pennsylvania Supreme Court decision in June to overturn Cosby's conviction created a dangerous precedent by giving a press release the legal weight of an immunity agreement.

Montgomery County District Attorney Kevin Steele called the court's decision “an indefensible rule,” predicting an onslaught of criminal appeals if it remains law.

“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,” Steele wrote in the filing, which seeks review under the due process clause of the U.S. Constitution.

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.

The only written evidence of such a promise is a 2005 press release from then-prosecutor Bruce Castor, who said he did not have enough evidence to arrest Cosby.

The release included an ambiguous “caution” that Castor “will reconsider this decision should the need arise.” The parties have since spent years debating what that meant.

Steele's bid to revive the case is a long shot. The U.S. Supreme Court accepts fewer than 1% of the petitions it receives. At least four justices on the nine-member court would have to agree to hear the case. A decision on the petition, filed Wednesday but only made public Monday, is not expected for several months.

Castor's successors, who gathered new evidence and arrested Cosby in 2015, doubt Castor ever made such a deal. Instead, they say Cosby had strategic reasons to give the deposition rather than invoke his Fifth Amendment right to remain silent, even if it backfired when “he slipped up” in his rambling testimony.

Cosby's spokesperson called Steele “obsessed” with the actor and said he only hoped to please “the #MeToo mob.” Defense lawyers have long said the case should never have gone to trial because of what they call a “non-prosecution agreement.”

“This is a pathetic last-ditch effort that will not prevail. The Montgomery's County's DA's fixation with Mr. Cosby is troubling to say the least,” spokesperson Andrew Wyatt said in a statement.

Cosby, 84, became the first celebrity convicted of sexual assault in the #MeToo era when the jury at his 2018 retrial found him guilty of drugging and molesting college sports administrator Andrea Constand in 2004.

He spent nearly three years in prison before Pennsylvania's high court ordered his release.

Legal scholars and victim advocates will be watching closely to see if the Supreme Court takes an interest in the #MeToo case.

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

Appellate judges have voiced sharply different views of the Cosby case. An intermediate state court upheld the conviction. Then the seven justices on the Pennsylvania Supreme Court wrote three separate opinions on it.

The majority found that Cosby relied on the decision not to prosecute him when he admitted giving a string of young women drugs and alcohol before sexual encounters. The court stopped short of finding that there was such an agreement, but said Cosby thought there was - and that reliance, they said, marred his conviction.

But prosecutors call that conclusion flawed. They note that Cosby's lawyers objected strenuously to the deposition questions rather than let him speak freely.

Cosby himself has never testified about any agreement or promise. The only alleged participant to come forward is Castor, a political rival of Steele's who went on to represent President Donald Trump in his second impeachment trial. Castor said he made the promise to a now-dead defense lawyer for Cosby, and got nothing in return.

He never mentioned it to his top assistant, who reopened the case in 2015 after a federal judge unsealed Cosby's deposition.

At a remarkable pretrial hearing in February 2016, Castor spent hours testifying for the defense. The judge found him not credible and sent the case to trial.

The Pennsylvania Supreme Court, in its ruling, called Cosby's arrest “an affront to fundamental fairness.”

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.

Cosby, a groundbreaking Black actor and comedian, created the top-ranked “Cosby Show” in the 1980s. A barrage of sexual assault allegations later destroyed his image as “America's Dad” and led to multimillion-dollar court settlements with at least eight women. But Constand's case was the only one to lead to criminal charges.

Five of Cosby's accuser's testified for the prosecution to support Constand's claims, testimony that Cosby's lawyers also challenged on appeal. However, the state's high court declined to address the thorny issue of how many other accusers should be allowed to take the stand in a criminal case before the testimony becomes overkill.

In a recent memoir, Constand called the verdict less important than the growing support for sexual assault survivors inspired by the #MeToo movement.

“The outcome of the trial seemed strangely unimportant. It was as if the world had again shifted in some much more significant way,” Constand wrote in the book, “The Moment.”

The Associated Press generally does not name alleged victims of sexual assault unless they speak publicly, as Constand has done.

Cheryl Carmel, who served as jury foreperson at Cosby's retrial, said she was glad to see Steele ask for the review.

“I firmly believe that what we decided was correct, or else I wouldn't have made that decision … with the group. Having it overturned because of something that was outside of the facts of what we were given is disappointing,” Carmel told The AP on Monday.