An uncovered email sent by a former Pa. district attorney may derail the criminal case pending against Bill Cosby.

CNN is reporting that Bruce Castor, the former Montgomery County District Attorney, made a verbal agreement with Cosby’s legal team that his 2005 civil case deposition would not be used in subsequent criminal trials.

Castor detailed that agreement in an email to his successor, Risa Vertri 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,” Castor wrote in the email. “I cannot believe any state court judge would allow that deposition into evidence.”

The email was sent three months before Pa.’s current district attorney, Kevin Steele, filed charges against Cosby.

Castor thought that using the deposition testimony would lead the 78-year-old actor to take legal action against Montgomery County.

Steele disagrees. The newly-elected district attorney told CNN that Cosby’s testimony is fair game in the criminal case.

“There is a specific legal method to grant immunity. That was not done in 2005,” he told CNN.

The 2005 deposition is considered a key piece of evidence in the criminal case against Cosby because he admits that he purchased Quaaludes and gave alleged victim, Andrea Constand, “three friends to make (her) relax.”

Cosby is charged with three felony sexual assault charges.