Former Montgomery County District Attorney Bruce Castor told a judge on Tuesday that he had not entered into an agreement with Bill Cosby not to pursue charges in a 2005 sexual assault case against the comedian.

According to NBC, Cosby's attorneys had argued that current sex abuse charges, based on evidence from the older case, should be dropped because of the alleged agreement.

During his lengthy testimony, Castor said that he did not have the power to enter into such an arrangement. He added that prosecutors instead decided not to move forward in the 2005 case against Cosby because the primary witness had "credibility issues."

His testimony could be a blow to Cosby, who was criminally charged late last year with sexually assaulting Andrea Constand, after more than 50 women emerged to allege they too had been drugged and sexually abused by him over a period dating back to the 1960s.

In addition to denying all the allegations, Cosby has fought to have the Constand case dismissed on the grounds Castor made a legally binding deal with his attorneys not to prosecute.

Throughout the proceedings, Cosby sat silently as Castor testified that he believed Constand had been "inappropriately touched." The former DA said he privately hoped that she would become a "millionaire" by suing the comedian.

"There were a number of inconsistencies that caused me concern," Castor added in explaining why he never moved forward with criminal charges. He testified that one of the aspects that bothered him most was the fact Constand went to a civil attorney before reporting the alleged incident to authorities.

"I decided that there was insufficient credible evidence on which any charge related to Mr. Cosby as alleged by Ms. Constand could be proven beyond a reasonable doubt," Castor said. The former DA added that much of the testimony he could have gained from other victims would have largely been ineffective because too much time had passed after many of the alleged incidents to pursue cases.

Castor added he thought the decision not to charge Cosby would strip him of the ability to plead the Fifth Amendment in the civil case. He admitted he shared his strategy with Cosby's attorney at the time, who is now deceased, but insisted there was no "agreement" between them.

"I thought at the time and still think that making Mr. Cosby pay money to Ms. Constad would be the best stage I could set," he said.