Bill Cosby fighting sex assault charge in Pennsylvania court
Actor Bill Cosby attends the American Comedy Awards in New York April 26, 2014. REUTERS/Eric Thayer

Bill Cosby appeared at a suburban Philadelphia courthouse on Tuesday to fight sexual assault charges, which his lawyers say violate a decade-old agreement with a former district attorney not to prosecute the disgraced comedian.

Dressed in a dark brown suit, walking with a cane and flanked by attorneys and what appeared to be a security guard, the 78-year-old entertainer made no comment as he entered the courthouse to face charges of sexually assaulting a former women's basketball team manager at his alma mater, Temple University.

More than 50 women have accused Cosby of drugging and sexually assaulting them but the case of Andre Constand is the only one to result in criminal charges. The wave of allegations has cost Cosby, once the beloved dad Heathcliff Huxtable in the long-running 1980s television hit "The Cosby Show," his status as one of the United States' most-admired entertainers.

Cosby has repeatedly denied wrongdoing. Many of the cases date to the 1960s and 1970s, making them ineligible for criminal prosecution, although his alleged victims also have filed a series of civil lawsuits claiming Cosby defamed them by calling them liars.

The Montgomery County District Attorney's office charged Cosby with the 2004 sexual assault of Constand in late December, days before the statute of limitations was to expire. 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 Benadryl, an anti-allergy medication, to Constand 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.

Castor was the first witness to take the witness stand on Tuesday, answering basic questions about his background before one of Cosby's attorneys, Brian McMonagle, began to ask about Constand's credibility as a witness.

"Your honor, I've been doing this a long time, I'm wondering if you should do this in camera," Castor said, using a legal term to refer to testimony taken in private. The judge agreed to the request and the court went into a brief recess.

Prosecutors in Los Angeles County early this month decided not to charge Cosby over two alleged cases of sexual assault dating to 1965 and 2008.

(Reporting by Daniel Kelley; Writing by Joseph Ax and Scott Malone; Editing by Grant McCool and Bill Trott)