NORRISTOWN, Pa. (Reuters) - Comedian Bill Cosby on Tuesday sought to derail Pennsylvania prosecutors’ effort to make him stand trial on sexual assault charges, contending that a deal reached over a decade ago gave him immunity from prosecution.

An entertainer who built a career on family-friendly comedy, Cosby now faces accusations from more than 50 women that he sexually assaulted them, often after plying them with drugs and alcohol, in a series of attacks dating to the 1960s.

Prosecutors late last year charged Cosby, 78, with sexually assaulting Andrea Constand, a former basketball coach at his alma mater Temple University, just days before the statue of limitations to bring charges ran out.

Constand’s allegations are the only ones to have resulted in criminal charges against Cosby, although he also faces a series of civil lawsuits related to alleged rapes.

Cosby has long denied wrongdoing, and his lawyers have asked the judge to dismiss the Constand case.

Former Montgomery County District Attorney Bruce Castor testified on Tuesday that he decided in 2005 not to bring charges over the Constand allegations.

A 2005 press release in which Castor said Cosby would never be prosecuted was read out in court, with defense attorneys contending it represented a non-prosecution agreement. No other written record of that agreement has been presented by either side.

Castor, called to testify at a pretrial hearing by Cosby’s lawyers, said he feared Constand’s credibility as a witness could have been undermined because she waited a year to file her criminal complaint against Cosby and hired a lawyer to explore a civil lawsuit.

He said that he believed Constand’s allegations but had worried that a jury would not.

“Making Mr. Cosby pay money to Ms. Constand was the best I would be able to set the stage for because a prosecution was not viable and never would be,” Castor said during a hearing in a suburban Philadelphia court. “I was hopeful that I had made Ms. Constand a millionaire.”

The fact that the victim of a crime was also pursuing a civil lawsuit would not normally influence the outcome of a criminal trial, said Cornell Law School professor Kevin Clermont.

“This is a very minor concern,” Clermont said. “You could just as easily ask, ‘Is it true that some day you may sue?’”

Slideshow ( 20 images )

TESTIMONY UNSEALED

Castor said his decision not to prosecute Cosby prevented the entertainer from invoking his constitutional right against self-incrimination when he gave a deposition for a civil suit against Constand.

A judge last year unsealed that testimony, in which Cosby acknowledged giving what he described as Benadryl to Constand in 2004 but portrayed the encounter as consensual.

Constand, now 44, said Cosby plied her with drugs and alcohol before sexually assaulting her.

Slideshow ( 20 images )

A California judge on Tuesday ordered Cosby to give a new deposition in a separate civil lawsuit brought by a woman who accused him of sexually assaulting her at the Playboy Mansion in 1974, when she was 15 years old.

Dressed in a dark brown suit, walking with a cane and flanked by attorneys and what appeared to be a security guard, Cosby sat stonily during Tuesday’s proceeding and did not speak.

Attorney Gloria Allred, who represents 29 of the women who have accused Cosby of sexual assault, criticized his lawyers for trying to have charges dismissed before trial.

“I thought Mr. Cosby wanted his day in court and now he’s wanting to avoid his day in court,” Allred said on Tuesday.