UPDATE (Jan. 14): Read the most recent court order here. There will be a hearing regarding the Habeas Corpus motion on Feb. 2.

Bill Cosby’s criminal defense attorneys are asking the judge to dismiss the criminal charges filed at the end of last year or at least disqualify the Montgomery County District Attorney from handling the case.

So what’s going on?

You may recall that Cosby was sued by Andrea Contand more than a decade ago for sexual assault. At the time, Constand worked at Temple University in Philadelphia. (She lives in Canada now.) Bruce Castor was the elected District Attorney of Montgomery County when the allegations were made. Castor left the office at the end of 2007 but ran again last year. He lost a bitter election battle to Kevin Steele, now the new District Attorney who brought the current charges against Cosby. In February 2005, Castor issued a press release in which he said he was not filing criminal charges against Cosby. He also included this statement:

“District Attorney Castor cautions all parties that he will reconsider this decision should the need arise.”

That sure sounds like he left open the possibility that, with new or additional evidence, he might still file criminal charges. The next year, however, Bill Cosby testified under oath at his deposition in Constand’s civil case. If Cosby feared there remained the chance of criminal charges, his attorney would have advised him to take the 5th Amendment at the deposition. But Cosby did not do that. Instead he admitted under oath to giving drugs in order to have sex–saying it was consensual sex. It was that very deposition that was released last summer and apparently is the basis of the current criminal charges.

What’s the problem then?

Cosby’s attorneys are now saying that Castor made a promise sometime after the press release that no criminal charges would be filed, and that Cosby relied on that promise when he testified. In other words, without that promise of no criminal charges, Cosby would have taken the 5th at the deposition. If Castor did, indeed, make that promise, then it should have been in writing. Cosby’s attorney at the time has since died. If there is a written agreement not to prosecute, it hasn’t been made public yet. But without a written agreement, Castor could still confirm its existence. In a recent, lengthy court filing laying out this argument, Cosby’s attorneys say they are prepared to call Castor as a witness at a hearing to establish that he made such a promise.

Cosby’s attorneys say the agreement is true and that it’s binding on the Commonwealth of Pennsylvania which means that no one—including a newly-elected District Attorney—can violate it. They are asking the court to dismiss the charges or at least disqualify the Montgomery Count District Attorney.

I’m no fan of Bill Cosby but I am a fan of the law and one’s due process rights. If this binding non-prosecution agreement exists, then Cosby should not be prosecuted for sexual assault of Andrea Constand. At a minimum, if the prosecution goes forward, then Cosby’s statements in the civil deposition should not be used against him.