78-year-old comedian Bill Cosby is seen leaving The Montgomery County Courthouse in Norristown, Pennsylvania after his Preliminary Hearing on May 24, 2016.

78-year-old comedian Bill Cosby is seen leaving The Montgomery County Courthouse in Norristown, Pennsylvania after his Preliminary Hearing on May 24, 2016.

*A judge ruled Tuesday that Bill Cosby’s trial on sexual assault charges could go forward, shutting down five months of efforts by his lawyers to have the charges dismissed.

Cosby was charged in December with aggravated indecent assault for allegedly drugging and sexually assaulting Andrea Constand in January 2004 at his Elkins Park, Pennsylvania mansion. Cosby became a mentor to the former Temple University staff member, but prosecutors say he took advantage of his counseling role, gave her pills and assaulted her at his home.

Bill Cosby departs the Montgomery County Courthouse after a preliminary hearing, May 24, 2016, in Norristown, Pennsylvania.

Bill Cosby at the Montgomery County Courthouse during a preliminary hearing, May 24, 2016, in Norristown, Pennsylvania.

Today’s ruling, by Judge Elizabeth A. McHugh, capped a 3½-hour hearing at the Montgomery County Courthouse in Pennsylvania. “This case will move forward,” Judge McHugh told the crowded courtroom. Flanked by his lawyers throughout the hearing, Cosby stood at the end and said, “Thank you.” The judge wished him luck. The 78-year-old comedian was helped from the courtroom by his aides without saying another word.

His three lawyers crowded into a separate car and would not comment on the decision beyond offering a thumbs up when asked how Cosby was feeling.

Constand was not present in the courtroom.