Montgomery County District Attorney Risa Vetri Ferman didn't waste time after receiving an email last fall from her predecessor, Bruce L. Castor Jr., outlining why he thought Bill Cosby had a legally binding agreement protecting him from prosecution for an alleged 2004 sexual attack.

Within a day, Ferman replied, in a bid to settle the issue. She and her investigators had talked to lawyers for Cosby and his accuser, Andrea Constand, and neither had documentation of any deal, she wrote. And though Ferman had been Castor's top assistant and the contact for Constand's legal team in 2005, she couldn't recall an agreement, either.

"The first I heard of such a binding agreement was your email," she wrote, asking Castor for records confirming it.

The letter, hand-delivered to Castor in September and disclosed Wednesday, was the pillar of an 81-page court filing current prosecutors hope will rebuff what they call weak attempts by Cosby to derail, dismiss, or diminish the criminal case against him.

Filed in advance of a scheduled Feb. 2 hearing, the motion also appeared to cast the county's two most recent previous district attorneys - lawyers whose careers are deeply entwined - on opposite sides of what has become a hotly contested dispute in the office's most high-profile prosecution in years.

Castor, now in private practice, is expected to testify for Cosby's defense at the hearing about the "non-prosecution agreement" he says he made with the 78-year-old entertainer 10 years ago, after concluding he did not have enough evidence to arrest him.

Castor has said that deal forced Cosby to testify in a civil suit Constand filed against him, which was settled out of court for an undisclosed sum.

After serving as his top assistant, Ferman succeeded Castor when he became a county commissioner, and this month was sworn in as a Common Pleas Court judge. Among her last acts as district attorney was to file the aggravated indecent assault counts against Cosby.

When Ferman reopened the investigation last summer, her first assistant, Kevin Steele, was running against Castor in the race to succeed her. Their campaigns grabbed national attention last fall after Steele ran TV ads attacking Castor's handling of the Cosby case.

Now leading the Cosby prosecution as district attorney, Steele said in Wednesday's filing that no non-prosecution agreement ever existed. He noted the news release Castor issued in 2005 announcing that he would not prosecute Cosby, which the comedian's lawyers have cited as evidence of the deal.

"The news release . . . never mentions the Fifth Amendment or immunity, and it does not contain a promise that [Cosby] would never be arrested. In fact, it says the contrary," Steele wrote, noting a line in which Castor wrote he could revisit the decision if the need arose.

Castor has since said that line refers to his promise not to say anything more about the case publicly, not his decision to decline prosecution.

Cosby's lawyers - Brian McMonagle and Monique Pressley - say their client testified freely in a civil deposition because he believed his words could never be used against him. Neither responded to requests for comment Wednesday.

"The notion of actually demanding a prosecutor's office be made to keep its promises may also be novel," Pressley tweeted Wednesday night.

The transcript of the deposition Cosby gave over four days in 2005 and 2006 was released last summer. In it, Cosby acknowledges having a sexual encounter with Constand the night of the alleged January 2004 attack, and concedes he gave her three blue pills and wine after she complained of feeling sick. However, he maintains that their liaison was consensual.

Cosby "was free to assert his Fifth Amendment rights during his deposition in the civil case," Steele contends in his filing. "He simply chose not to do so, just like he chose not to remain silent when he gave a police statement on Jan. 26, 2005."

Prosecutors have cited the deposition as a factor in their decision to reopen the Constand investigation. But they say they also relied on the original 2005 case file, and new interviews with Constand and other witnesses.

As part of her 2006 settlement with Cosby, Constand agreed that she would not initiate criminal proceedings against Cosby.

She was not barred, however, from cooperating with law enforcement agencies on any investigation they might open on their own.

Arrested in December, Cosby could face between five and 10 years in prison if convicted of aggravated indecent assault.

Despite allegations from dozens of women nationwide that he drugged and molested them, the Montgomery County case marks the first time he has faced criminal charges.

In its first filing this month, his defense team said the current prosecution violated the deal with Castor.

If defense attorneys lose that argument to dismiss the charges, they want a judge to disqualify Steele's office from prosecuting the case, arguing that he improperly used his campaign ads, faulting Castor and suggesting he would charge Cosby, as a tool to win election.

Steele objected to that argument in Wednesday's filing, accusing Cosby of attempting to "pick his prosecutor." He also contended that the defense team's efforts were premature and should wait until after prosecutors have the chance to hold an evidentiary hearing on the accusations.

Steele urged County Court Judge Steven T. O'Neill to cancel the hearing on the defense motion and proceed with a preliminary hearing.

"This case appear[s] to be one of the few in which a prosecution might still be possible," Steele wrote, a reference to the statute of limitations that has kept police in other jurisdictions from bringing charges on allegations by any of the dozens of other Cosby accusers. "The need to act, to seek justice, could not be ignored. Put simply, the case got stronger with new information and the need for prosecution became more compelling."

lmccrystal@phillynews.com

610-313-8116 @Lmccrystal