Actor and comedian Bill Cosby arrives for a court appearance, Feb. 3, 2016, in Norristown, Pa.
Photo by Mel Evans/AP

Judge won’t stop Bill Cosby sex assault trial due to old ‘deal’

Updated

A Pennsylvania judge ruled Wednesday that a sexual assault case against Bill Cosby can move forward after finding that a 2005 decision not to charge him with a crime doesn’t stop prosecutors from putting him on trial now.

The actor’s lawyers claimed that the Montgomery County District Attorney’s office made a no-prosecution deal a decade ago that is still in force, but the current DA argued it wasn’t a binding agreement.

RELATED: Bill Cosby escapes criminal charges on two rape cases

After a two-day hearing, the judge decided not to toss out a charge of aggravated indecent assault against the 78-year-old comedian, setting the stage for a trial.

The charge stems from allegations by Andrea Constand that Cosby drugged and molested her at his home in the Philadelphia suburbs in 2004.

Cosby’s legal team said Wednesday they will appeal. “After two days presentation of evidence and law in support of Mr. Cosby’s habeas petition, the decision reached by the court was wrong,” his attorneys said in a statement.

Changing America, 1/5/16, 10:08 AM ET

How will Cosby’s crimes impact his legacy?

Authorities in Pennsylvania charged actor and comedian Bill Cosby with second degree aggravated indecent assault. NBC Latino’s Sandra Lilley , NBC Contributor Raul Reyes, NBC BLK’s Amber Payne, and NBC Asian America’s Traci Lee discuss how these…

Linda Dale Hoffa, A former state and federal prosecutor who is now a defense lawyer, said the ruling wasn’t shocking.

“The judge today made a ruling that makes sense and is not surprising. Defense lawyers know that a District Attorney’s promise to never prosecute has to be in writing to be enforceable,’ said Hoffa.

“If they have a chance to appeal, they will appeal,” she added. “And that would take months. They could try to take it all the way up to the supreme court.”

Cosby has denied any criminal wrongdoing. In a deposition he gave in a lawsuit filed by Constand, he admitted he gave her Benadryl and wine but said the encounter was consensual.

Cosby’s lawyers say they would never have let him sit for the deposition if they thought the criminal case could be reopened in the future.

The current DA charged Cosby in December as a string of women went public with sexual misconduct or assault accusations against the man best known as TV dad Cliff Huxtable.

The ex-DA, Bruce Castor, testified during the hearing that while he believed Constand’s story that Cosby had “inappropriately touched” her, she had “credibility issues” that would have made it impossible to get a conviction.

RELATED: Cosby could lose top honor

A preliminary hearing in the criminal case was set for March 8.

No other criminal charges have been filed against Cosby, although he is facing lawsuits by accusers in California and Massachusetts. He has also sued some accusers for defamation.

This story originally appeared on NBCNews.com.

Bill Cosby and Sexual Assault

Judge won't stop Bill Cosby sex assault trial due to old 'deal'

Updated