By Matthew T. Mangino

The purported deal between former Montgomery County District Attorney Bruce Castor and Bill Cosby has had an immediate impact on Cosby's prosecution. No, it hasn't resulted in the case being thrown out - yet - but it has resulted in the prosecution being delayed and derailed.

Defense attorneys contend that the charges against Cosby violated an agreement struck in 2005 with Castor. Cosby's lawyers say Castor promised not to prosecute the comedian if he agreed to testify in a civil lawsuit filed by his accuser, Andrea Constand.

First the delay: The case is on hold while the Superior Court considers the current Montgomery County district attorney's motion to quash the appeal filed by Cosby challenging the court order allowing the criminal case to proceed.

Now the derailment: Setting aside that Constand is suing Castor and the new district attorney is fighting Castor's subpoena seeking his 2005 investigation files, there is a lot more at stake than the prosecution of a high-profile defendant for a particularly salacious crime.

The underlying issue is, can an accused rely on the promise of a prosecutor? The answer will have ripple effects for the entire criminal justice system.

When Cosby was charged, only days before District Attorney Kevin Steele took office, his attorneys immediately requested the charges be dismissed because of a deal with Castor more than a decade ago.

At a hearing seeking dismissal of Cosby's charges, Castor was called as the first witness. Castor testified that last year, he contacted then-District Attorney Risa Vetri Ferman to tell her to "tread carefully." The media attention was intense at the time as the Cosby case became an issue in the Montgomery County district attorney race between Castor and Steele.

"I knew that I had bound the commonwealth, as representative of the sovereign, not to arrest Mr. Cosby ... and I wanted to make sure that she [Ferman] didn't make a mistake and go ahead and move against Cosby," Castor testified.

Castor declined to prosecute Cosby for sexual assault of Constand in 2005. At the time, he explained, "The district attorney finds insufficient credible and admissible evidence exists upon which any charge against Mr. Cosby could be sustained beyond a reasonable doubt." He continued, "Much exists in this investigation that could be used [by others] to portray persons on both sides of the issue in a less than flattering light."

Steele suggested that new evidence unearthed in the years since Castor declined to prosecute Cosby had made the case viable once again. He claimed that the information derived from Cosby's deposition was an important factor in his decision to file charges.

When he was asked why the agreement wasn't memorialized in writing, Castor's response, as summarized by the Legal Intelligencer, was that "he felt it was not appropriate at the time, since no civil case had yet been filed. He said it would be a suggestion that Cosby did something wrong, and that he wanted to use transactional immunity, which he said is a function of the district attorney."

District attorneys are bound by agreements, written or sealed with a handshake, every day. For instances, the plea bargain, the grease that keeps the criminal justice system rolling, is based on an offer and acceptance - known in legal parlance as a contract. A defendant who relies on a contract to his detriment can force that contract to be honored.

Cosby was not compelled to testify. He did not invoke his Fifth Amendment right. Cosby voluntarily entered into an agreement, a contract, to testify in the civil case in exchange for not being prosecuted criminally.

Cosby would have been protected by the U.S. Constitution if he refused to be deposed by Constand's attorneys. Instead, relying on the district attorney's promise, Cosby testified. Now, ignoring that commitment, the new district attorney is zealously trying to get out of the deal.

Such conduct is not without consequences - namely, distrust for the system and a chilling effect on cooperating, testifying, and even agreeing to plea bargains.

Matthew T. Mangino is of counsel with Luxenberg, Garbett, Kelly & George. He is a former district attorney of Lawrence County and the author of "The Executioner's Toll." mmangino@lgkg.com