Image copyright European photopress agency Image caption Cosby waved to fans as he left court in Pennsylvania

US prosecutors can proceed with a sexual assault charge against comedian Bill Cosby, a judge has ruled.

Mr Cosby is accused of drugging and fondling a former Temple University employee in 2004.

On Wednesday, a judge in Pennsylvania rejected arguments made by his lawyers that a previous ruling in 2005 made him immune from prosecution.

Dozens of women have said the actor assaulted them but the former TV star says the encounters were consensual.

The next step in this case will be a hearing to determine whether there is enough evidence for the actor to stand trial.

The comedian, once the highest paid US television star, could go to prison for 10 years if convicted.

Judge Steven O'Neill issued the ruling at a court in Norristown, just outside Philadelphia, after a two-day hearing.

Image copyright AP Image caption Cosby (centre) denies any wrongdoing

The complaint by Andrea Constand, who has waived her right to anonymity, was first made after the alleged assault.

But the then district attorney, Bruce Castor, decided in 2005 there was insufficient evidence to prosecute.

However, lawyers who succeeded Mr Castor decided last year to reopen the case after other women came forward with similar accusations.

Documents from Ms Constand's civil lawsuit against the star were sealed until last summer.

Document that sets out allegation

Mr Cosby's defence team this week put Mr Castor on the stand to argue that the criminal case should be dismissed because his decision in 2005 was "binding" and made the actor forever immune from prosecution.

"In this case, the prosecution should be stopped in its tracks,'' said lawyer Chris Tayback.

"Really what we're talking about here is honouring a commitment."

But District Attorney Kevin Steele demanded to know what proof there was that Mr Castor ever made such an agreement, since it was never put in writing, and questioned what authority he had to make such a deal.