The victim in Bill Cosby's criminal sex-assault case has settled a defamation lawsuit against a former prosecutor who said she added details to her story over time.

Andrea Constand's suit against Bruce Castor had been set for trial in April in Philadelphia after a federal judge refused to dismiss it. The case then settled this week, court records show.

Constand's lawyer, Dolores Troiani, said Thursday that the terms are confidential and both sides had agreed not to comment.

BILL COSBY'S LAWYER OUTLINES 11 ALLEGED TRIAL ERRORS IN APPEAL

Castor had declined to charge the actor when Constand went to police in suburban Philadelphia in 2005 to say "America's Dad" had drugged and molested her a year earlier. In a statement, he said that both parties could be portrayed in "a less than flattering light."

When the criminal case was reopened a decade later, Castor defended the decision to The Associated Press.

"If the allegations in the civil complaint were contained with that detail in her statement to the police, we might have been able to make a case out of it," Castor said. Troiani demanded a public apology, saying Castor had revictimized her client.

JUDGE REJECTS BILL COSBY'S BID FOR A NEW TRIAL

"This is outrageous that a victim of a crime could be treated this same way — twice — by the same man," Troiani said at the time.

A new prosecutor arrested Cosby in 2015 after documents from her 2005 civil suit against Cosby were unsealed, revealing Cosby's damaging testimony about sexual encounters with Constand and others. He was convicted this year of sexually assaulting Constand and is serving a three- to 10-year sentence at a state prison near Philadelphia.

Castor and his lawyers did not immediately return messages late Thursday.

CLICK HERE TO GET THE FOX NEWS APP

Cosby settled Constand's civil lawsuit for nearly $3.4 million.