Lawyers for disgraced comedian Bill Cosby are urging a Pennsylvania judge to throw out criminal charges of sexual assault against him, arguing that the case violates a prosecutor's decade old agreement not to charge Cosby.

Cosby, 78, appeared in a criminal court in Norristown, Pennsylvania on Tuesday, where he was charged in December with the 2004 assault of Andrea Constand, a former women's basketball team manager at Temple University in Philadelphia, Cosby's alma mater.

Dozens of women have accused Cosby of assaults stretching back decades, but the prosecution brought by the Montgomery County district attorney's office is the only criminal case he has faced. Constand, now 44, said Cosby plied her with drugs and alcohol before sexually assaulting her.

Cosby's lawyers have asked Common Pleas Court Judge Steven O'Neill to dismiss the case, citing a supposed agreement reached in 2005 with then-District Attorney Bruce Castor.

Under that deal, Cosby's lawyers say, Castor promised not to prosecute Cosby over Constand's allegations if he agreed to testify under oath in a civil lawsuit she filed against him.

A judge last year unsealed that testimony, in which Cosby acknowledged giving her Benadryl, an anti-allergy medication, but portrayed the encounter as consensual. Prosecutors are generally free to use civil depositions as evidence in criminal cases.

Castor is prepared to testify that he told Cosby's lawyers he would not bring charges in exchange for the testimony, according to court papers.

But prosecutors have said in court filings that no documentation exists to corroborate any such agreement. Moreover, they argue, Castor did not have the authority to bar his office forever from pursuing criminal charges against Cosby.

The Constand allegations played a crucial role in last year's campaign for district attorney, which pitted Castor against Kevin Steele.

Steele, who attacked Castor during the race for failing to prosecute Cosby, won election in November and then charged Cosby just before the statute of limitations expired.

The accusations by more than 50 women have destroyed the reputation of the once-beloved Cosby, whose father-figure persona made him a popular entertainer for years.

Sign up to our free newsletters

Get the best updates straight to your inbox:
Please select at least one mailing list.

You can unsubscribe at any time by clicking the link in the footer of our emails. We use Mailchimp as our marketing platform. By subscribing, you acknowledge that your information will be transferred to Mailchimp for processing.