A US judge has paved the way for disgraced TV legend Bill Cosby to stand trial on a sexual assault charge dating back more than a decade, throwing out an attempt by his lawyers to dismiss the case.

It is the first criminal charge filed against the 78-year-old Mr Cosby among dozens of allegations of sexual assault spanning four decades.

The megastar turned pariah spent the last two days in court in Norristown, just outside Philadelphia, as his lawyers disputed the legality of revisiting the case, which dates back to 2004 and was settled in 2006 by a civil suit.

Cosby posted bail of $1 million (€901,997) on 30 December 2015.

His lawyers argued the charge violates a 2005 agreement that he would never be prosecuted over the allegation of assault made by Andrea Constand, a former employee of Temple University in Philadelphia.

Ms Constand says Mr Cosby forced himself on her at his suburban Philadelphia home in 2004. Prosecutors say he urged her to take pills and drink wine, leaving her unable to resist as he made his move on her.

If found guilty, Mr Cosby - who has surrendered his passport to the court but has yet to enter a plea to the criminal charge - could face up to 10 years in prison and a $25,000 fine.

Statutes of limitations prevent most of the women who have accused the comedian of sexual assault from taking legal action.

In the Pennsylvania case, the statute of limitations is set to expire early next year.