More women are coming forward with allegations that they were sexually assaulted by comedian Billy Cosby
Bill Cosby thinks he has a way to get out of the sex charge against him. Reuters

Besieged comedian Bill Cosby is preparing to plead immunity from a sex assault charge based on what his lawyers are claiming is a "get out of jail free email" from a former Philadelphia government official. Cosby has been charged with three counts of aggravated assault on a young women 11 years ago. Nearly 50 women have accused Cosby of sexual assault.

Cosby was charged in 2005 as part of a civil suit by Andrea Constand, a Temple University basketball team employee who considered Cosby a mentor. The suit was settled with an undisclosed payment from the comedian. In his statement under oath, Cosby admitted drugging Constand during sexual encounters but said it was by mutual consent. He also admitted paying off other women to keep them quiet after similar encounters.

Bruce Castor, Montgomery County district attorney at the time of the deposition, promised Cosby verbally that he wouldn't be prosecuted if the comedian agreed to a deposition, according to an email obtained by CNN. Castor believed it was the best strategy to get Constant a settlement, he said in the email to his successor written just months before charges were filed against Cosby.

"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.

He added: "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."

Cosby's deposition is the key to the charges against him.

But the current district attorney, Kevin Steele, said there is no evidence of a signed immunity agreement, which would have had to go through proper channels. Constand's lawyer has said she wasn't aware of any such an agreement.

Cosby's lawyer plans to use the email in a bid to get the case against their client dismissed at a court hearing on 2 February. A statement from the attorneys said 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."

Dozens of women have accused Mr Cosby of sexual assault, dating back to the 1970s. Only one charge has been brought because of the statute of limitations has passed on most of the accusations.