Bill Cosby's lawyers may face difficulty in convincing a Pennsylvania judge this week to throw out sexual assault charges in light of what the disgraced comedian's defense team characterizes as a decade-old non-prosecution deal, legal experts said.

Cosby is due back in court in Norristown, Pennsylvania, on Tuesday, after the 78-year-old entertainer was charged last month with sex assault in 2004. The alleged victim says Cosby had plied her with alcohol and drugs.

It is the only criminal prosecution that Cosby has ever faced, even though dozens of women have accused him of assault, in some cases decades ago.

The hearing outside Philadelphia will center on the defense's argument that the charges violate an agreement struck in 2005 with then-Montgomery County District Attorney Bruce Castor. Cosby's lawyers say Castor promised not to prosecute the comedian if he agreed to testify in a civil case brought by his accuser, Andrea Constand.

Castor has backed that account in an email sent in September to his successor as district attorney. In that email, Castor said he had reached a binding deal with Cosby's lawyers.

The defense has not produced any written agreement, a point made by prosecutors in seeking to undermine Castor's story.

"Cosby had good attorneys," said Anne Poulin, a law professor at Villanova University in Pennsylvania. "If they had negotiated something, I think they would have gotten something in writing."

But in court papers filed on Thursday, Cosby's lawyers said prosecutors had waited so long to bring charges that evidence verifying the agreement had disappeared.

Cosby's former lawyer has since died, and documents that might have corroborated the deal have been lost, they said.

Wesley Oliver, a law professor at Duquesne University in Pennsylvania, said it was highly unlikely that a document as critical as a non-prosecution agreement would go missing.

"This is not like some receipt for his taxes in 1953," he said. "This is a get-out-of-jail free card. This is something you keep in a safety deposit box in a temperature-controlled room."

Castor may appear at the hearing to testify that he promised not to prosecute in exchange for Cosby's civil testimony. Castor's lawyer, Robert Pugh, said he had advised Castor not to comment publicly on the case.

Kevin Steele, who was elected last year as Montgomery County's district attorney after vowing during the campaign to work on charging Cosby, cited Cosby's recently unsealed testimony as crucial evidence in filing criminal charges last month.

Cosby has portrayed the encounter as consensual but acknowledged giving Constand Benadryl and wine, which she claims incapacitated her.

Cosby's lawyers did not return a call for further comment.

Even if Castor's claim is taken at face value, prosecutors have argued the deal did not carry formal immunity without a judge's approval under state law. In addition, they have said Castor did not have the authority to make such an arrangement.

Poulin, the Villanova professor, said she would be "shocked" if a judge found Castor had the power to "bind his office in perpetuity."

She also said that if a non-prosecution agreement really existed, Cosby could have sought a formal order of immunity from the judge overseeing the civil case.

That said, some experts said a judge could find that if Cosby relied on Castor's promise, it would be unfair for him to suffer the consequences.

Judy Ritter, a law professor at Widener University in Delaware, said the judge was unlikely to dismiss the entire case but could theoretically bar prosecutors from using Cosby's civil testimony.

"That depends on the finding of the facts," she said. "Who promised what, and what was said?"