A US judge has declared a mistrial in the sexual assault case of comedian and celebrity Bill Cosby after a jury said it was deadlocked following more than 52 hours of deliberations.

Cosby had been charged with three counts of sexual assault over allegations he drugged and molested Andrea Constand in 2004 at his home in Pennsylvania.

Prosecutors pledged to put Cosby on trial for a second time, saying Constand was "entitled to a verdict".

Andrew Wyatt, Cosby's spokesperson, said that the trial's outcome had "restored" his client's legacy.

READ MORE: US TV networks drop Bill Cosby programmes

But the reputation of Cosby, known as America's Dad for his role on the television series, The Cosby Show, remains in tatters after a slew of sexual assault allegations from about 60 women.

Several of those women attended the trial and wore buttons that read "We Stand in Truth".

Victoria Valentino, a former model who has accused Cosby of drugging and raping her decades ago, had a message for the celebrity.

"You're not off the hook, buddy," she said outside the courtroom.

Cosby has denied all of the women's claims, saying that any sexual encounters were consensual.

Constand accused Cosby of giving her unidentified pills in 2004 at his home [Ed Hille/Reuters]

The case involving Constand followed a long path to prosecution.

In 2005, prosecutors declined to charge Cosby based on Constand's account that the celebrity offered her unidentified pills that left her unable to stop his advances.

She filed a lawsuit that Cosby settled for an undisclosed sum.

Cosby's depositions in that case, however, were unsealed by a federal judge in 2015, revealing his admissions that he had given sedatives to young women in the 1970s.

This prompted prosecutors to reopen the case.

Cosby was eventually charged in December 2015, just days before the statute of limitations was set to expire.

He still faces several civil lawsuits from at least 10 accusers across the United States.

Source: News agencies