A Pennsylvania judge has ruled that a sexual assault case against Bill Cosby, in which the comedian is accused of drugging and assaulting former Temple University employee Andrea Constand in 2004, will go to trial.

Judge Steven O'Neill refused to throw out the case, rejecting a former district attorney's claim that he granted the comedian immunity from prosecution a decade ago.

The decision largely hinged on the judge's view of former Montgomery County District Attorney Bruce Castor's statements about whether Cosby should face charges, according to The Associated Press. Castor had said that he gave an unwritten promise of immunity for Cosby to his now-deceased lawyer, contending that Constand's lawyers wanted the agreement so Cosby would be free to testify in her civil suit.

Copyright 2016 NPR. To see more, visit http://www.npr.org/.