NORRISTOWN, Pa. (AP/WTXF) -- The former district attorney who declined to arrest Bill Cosby on sex-crime charges a decade ago testified Tuesday that he believes his decision shields the comedian from ever being prosecuted in the case.

Former Montgomery County District Attorney Bruce Castor took the stand in a bid by Cosby's lawyers to get the case against the TV star thrown out long before trial because of what they say is a non-prosecution agreement with Castor.

The current district attorney insists there is no record of any such promise.

Castor admitted the only place the matter was put in writing was in the 2005 press release announcing his decision not to prosecute.

He acknowledged that he didn't draw up a formal immunity agreement filed with a judge because, he said, Cosby was afraid that would make him look bad. Also, Castor said, "It was unnecessary because I concluded there was no way the case would get any better." And he said Cosby's lawyers did not insist on such a document.

The proceedings will resume on Wednesday, when Common Pleas Judge Steven T. O'Neill said he hopes to rule on whether to throw out the case.

Cosby, 78, was arrested and charged in December with drugging and violating former Temple University athletic department employee Andrea Constand at his suburban Philadelphia mansion in 2004. He could get up to 10 years in prison if convicted.

Castor said Tuesday that he believed Constand's story but that proving it would have been problematic because of serious flaws in the case, including what he called her inconsistencies and continued contact with Cosby. In deciding not to bring charges, he said, he meant to protect Cosby from prosecution "for all time."

And he suggested that Cosby and his then-lawyer understood it that way too, because Cosby later agreed to testify without invoking his Fifth Amendment right against self-incrimination in a lawsuit brought against him by Constand.

"Cosby would've had to have been nuts to say those things if there was any chance he could've been prosecuted," Castor said, referring to the damaging testimony unsealed last summer.

Castor said he hoped -- correctly, it turned out -- his ruling would prod Cosby to testify in the lawsuit and help Constand win damages. She eventually settled for an undisclosed amount.

"I was hopeful that I had made Ms. Constand a millionaire," the former DA said.

He said he and Cosby's then-attorney, Walter Phillips, did not have an actual agreement that Cosby would testify in exchange for not being prosecuted. Phillips has since died.

Kevin Steele, the newly elected DA who is pursuing the case, has said Cosby would need an immunity agreement in writing to get the case thrown out. He has said he has no evidence one exists.

Prosecutors on Tuesday pressed Castor on numerous, seemingly inconsistent statements he made over the years on whether Cosby could still face charges. Castor sparred with prosecutors, parsing the language in his press release and in various emails sent to his successor.

He said he was referring in some passages to bringing charges against Cosby in connection with other women and other crimes -- but not in connection with the Constand encounter in January 2004.

While Castor was called as witness by Cosby's side, the former DA said he is rooting for the prosecution.

Cosby watched the back and forth between Castor and the lawyers from the defense table, swiveling his head slightly as if at a tennis match. He showed no reaction when the courtroom erupted periodically in laughter over a quip from the talkative Castor, though he frequently smiled as he made small talk with his lawyers.

In a barrage of allegations that have destroyed Cosby's image as America's Dad, dozens of women have accused the former TV star of drugging and sexually assaulting them since the 1960s. But this is the only case in which he has been charged.

The unsealing of the testimony from Constand's lawsuit prompted Castor's successors to reopen the case and ultimately charge Cosby.

Cosby admitted in the deposition that he had affairs with young models and actresses, that he obtained quaaludes to give to women he wanted to have sex with and that he gave Constand three pills at his home. He said he reached into her pants but insisted it was consensual.

Castor defended his decision not to bring charges, testifying that he saw Constand's year-long delay in reporting the allegations, inconsistencies in her statements and her contact with a lawyer before going to police as problematic.

Castor said Constand's delay thwarted his ability to test her hair or fingernails for evidence she was drugged.

In related news, a Los Angeles judge ordered Cosby to attend another deposition in a lawsuit filed by a woman who says the comic forced her to perform a sex act on him at the Playboy Mansion around 1974, when she was 15.

Also Tuesday, model Chloe Goins dropped a lawsuit accusing Cosby of drugging and sexually assaulting her at the Playboy Mansion in 2008. Goins gave no explanation.