A former district attorney in Montgomery County, Pennsylvania, claims he agreed more than a decade ago that his office wouldn’t use a civil deposition given by Bill Cosby in any criminal matters, an email obtained by CNN shows — a revelation that could call into question the viability of the criminal case against the comedian.

The 2015 email — sent by former District Attorney Bruce Castor to successor Risa Vetri Ferman — details an apparent verbal agreement the prosecutor had a decade earlier with Cosby’s attorneys for Cosby to testify in a civil sexual assault case brought against him in 2005. In the email, Castor writes that his intent in making the deal was to create an atmosphere in which Cosby accuser Andrea Constand would have the best chance of prevailing in her civil suit against the 78-year-old comedian by removing the prospect of Cosby invoking his 5th Amendment right.

The email was sent three months before criminal charges were filed against Cosby in Montgomery County in December, and could call into question the viability of the case, CNN has learned.

In it, Castor writes to Ferman: “I can see no possibility that Cosby’s deposition could be used in a state criminal case, because I would have to testify as to what happened, and the deposition would be subject to suppression.

Bill Cosby: Evolution of an icon
16 photos: Bill Cosby: Evolution of an icon
“I cannot believe any state court judge would allow that deposition into evidence. …. Knowing this, unless you can make out a case without that deposition and without anything the deposition led you to, I think Cosby would have an action against the County and maybe even against you personally.”

The deposition is a key piece of evidence, cited by prosecutors as the impetus for reopening the case.

At the center of the case are allegations made by Constand, a former Temple University basketball employee, who says Cosby sexually assaulted her in his home in 2004.

Dolores Troiani, an attorney for Constand in 2005, told CNN’s Jean Casarez on Friday that she never knew about any such agreement between Cosby’s attorneys and prosecutors.

Castor, when asked by CNN about the email, declined to comment.

The current district attorney, Kevin Steele, who was elected in November after serving as Ferman’s longtime top deputy, told CNN on Friday: “There is a specific legal method to grant immunity. That was not done in 2005.”

Steele also noted that in Castor’s 2005 press release declaring there was insufficient evidence to prosecute Cosby that Castor himself said he would “reconsider this decision should the need arise.”

Felony charges against Cosby
Cosby faces three felony charges of sexual assault in Montgomery County, in connection with Constand’s allegations.

Cosby appeared in court in late December and didn’t enter a plea. But through his lawyers, Cosby has steadfastly denied wrongdoing in this case and dozens of allegations made by at least 50 other women.

Earlier this week, Cosby’s lawyers filed a motion asking for the charges against the comedian to be dismissed.

In a statement, Cosby’s attorneys asserted that the charges were “illegally, improperly and unethically brought by District Attorney Kevin Steele and his office.”

According to the statement, the charges “violate an express agreement made by the Montgomery County District Attorney in 2005, in which the Commonwealth agreed that Mr. Cosby would never be prosecuted with respect to the allegations of sexual assault made by complainant Andrea Constand.

“This agreement, made for the express purpose of inducing Mr. Cosby to testify fully in Ms. Constand’s civil litigation against him, led Mr. Cosby to give deposition testimony in 2005 and 2006 without invocation of his Constitutional rights against self-incrimination. Now, to fulfill campaign promises, the newly-elected District Attorney has repudiated the agreement and has based these criminal charges on the very testimony Mr. Cosby gave in reliance on the Commonwealth’s non-prosecution agreement,” the attorneys said.

Steele said Friday that his office would file a response to the motion to dismiss, which his office has said has no merit.

First public allegation
Constand was the first person to publicly allege sexual assault by Cosby.

In 2005, prosecutors declined to charge Cosby in the Constand case, citing insufficient evidence. But late last year, the new district attorney — Steele — was elected, and he made good on a campaign promise to swiftly reopen the case. Pennsylvania law has a 12-year statute of limitations for sexual assault cases.

“The charge by the Montgomery County District Attorney’s Office came as no surprise, filed 12 years after the alleged incident and coming on the heels of a hotly contested election for this county’s DA during which this case was made the focal point,” Cosby’s attorneys said in a statement after his arraignment. “Make no mistake, we intend to mount a vigorous defense against this unjustified charge and we expect that Mr. Cosby will be exonerated by a court of law.”

The criminal charges are the first to be levied against Cosby since the allegations arose, and the deposition is a vital piece of evidence.

This past July, nine years after the civil case was settled, a judge unsealed Cosby’s deposition in the Constand case in response to a motion by the media.

In it, Cosby admits he had sexual relationships with at least five women outside his marriage, gave prescription sedatives to women he wanted to have sex with and tried to hide affairs from his wife.

Cosby says he gave Constand one and a half tablets of Benadryl — an over-the-counter antihistamine that can cause drowsiness — to relieve stress.

In the deposition, he says the sex and drug-taking were always consensual.

In late December, the DA’s office filed a probable cause affidavit that alleges that Cosby “sought to incapacitate” Constand by giving her a mix of pills and wine that sent her slipping in and out of consciousness and left her unable to consent to sexual activity.

Temple ties
Constand was director of basketball operations at Temple University in Philadelphia when she met the comedian. Cosby is an alumnus — and was a very active one until the school distanced itself in the hail of accusations against the comedian.

In 2004, she visited him at his home in a Philadelphia suburb where she alleges a sexual assault took place.

Constand quickly spoke up. When prosecutors passed on a criminal case, she filed a civil lawsuit against Cosby. A lawyer deposed him, but Cosby settled with Constand in 2006; the case’s details were filed away, and years of relative quiet ensued.

Election issue
Nine years later, Montgomery County headed to the polls in November to vote for a new district attorney, and Kevin Steele turned the accusations against Cosby into part of his campaign platform. In the race to succeed Risa Vetri Ferman, Steele defeated Castor, and weeks later reconsidered criminally prosecuting Cosby.

Prosecutors re-examined the original investigation in light of the new documents, re-interviewed some witnesses and decided to pursue criminal charges.

“(When) we learned about allegations from other victims under similar circumstances, reopening this case was not a question,” Steele said.