The case against Bill Cosby for allegedly sexually assaulting Andrea Constand has been deemed a mistrial by the Pennsylvania judge overseeing the proceedings.

The judge said that the jurors were “hopelessly deadlocked” and commended them for their service.

“I remind everyone that this is not vindication or victory,” Judge Steven O’Neill said. “A mistrial is merely the justice system at work”.

Prosecutors in the case said that they will retry Cosby, who has been accused by dozens of women of using wealth, celebrity, and drugs to take advantage of them sexually.

Jurors had indicated earlier in the week that they were at an impasse over the case, and had asked to review nearly all of the key testimony from the case over the course of their deliberations. Still, the jurors remained deadlocked over the three counts of aggravated indecent assault that Cosby faced. Jurors were sent back repeatedly to reconsider the case.

The mistrial decision came on a rainy day in Norristown, Pennsylvania, where the case had been moved to following requests from the defence for a trial in a different area from the alleged crime. Reporters quickly assembled outside of the courthouse, awaiting word from the district attorney who prosecuted the case.

Bill Cosby: Career in pictures Show all 20 1 /20 Bill Cosby: Career in pictures Bill Cosby: Career in pictures Bill Cosby Winner of his first Emmy for 'I Spy' is Bill Cosby being congratulated by his wife Camille held at Americana Hotel, 1966 Bill Cosby: Career in pictures Bill Cosby Bill Cosby in 'I Spy', 1960s Bill Cosby: Career in pictures Bill Cosby Bill Cosby in July 1973 in Perth Bill Cosby: Career in pictures Bill Cosby Bill Cosby and Richard Pryor in 'California Suite', 1978 Bill Cosby: Career in pictures Bill Cosby Bill Cosby and Elmo in Sesame Street, 1989 Bill Cosby: Career in pictures Bill Cosby Bill Cosby poses for a picture with Florence Griffith-Joyner in June 1989 Bill Cosby: Career in pictures Bill Cosby Comedian Bill Cosby back in 1992 Rex Features Bill Cosby: Career in pictures Bill Cosby A scene from a 1992 episode of 'The Cosby Show' AP Bill Cosby: Career in pictures Bill Cosby US Monica Seles breaks into laughter as she jokes with comedian Bill Cosby during a celebrity match in the stadium at the US Open for the Arthur Ashe AIDS Challenge on 27 August 1995 Bill Cosby: Career in pictures Bill Cosby Bill Cosby meets Toronto Blue Jays' All-Star Joe Carter after the Stars played the Stripes in the Celebrity All-Star game which preceded workouts for the 67th All-Star Game at Veterans Stadium on 8 July 1996 in Philadephia Bill Cosby: Career in pictures Bill Cosby Co-hosts Oprah Winfrey and Bill Cosby joke with each other during the opening of the 2000 Essence Awards 14 April 2000 at Radio City Music Hall in New York City Bill Cosby: Career in pictures Bill Cosby Bill Cosby jokes with baseball great Hank Aaron after they both received the Presidential Medal of Freedom Award from U.S. President George W. Bush during a ceremony on 9 July 2002 at the White House in Washington Bill Cosby: Career in pictures Bill Cosby Bill Cosby poses backstage after winning the 'Bob Hope Humanitarian Award' during the 55th Annual Primetime Emmy Awards at the Shrine Auditorium on 21 September 2003 in Los Angeles Bill Cosby: Career in pictures Bill Cosby 'Tonight Show' host Jay Leno and comedian Bill Cosby laugh during a surprise visit by Cosby to sign a Harley-Davidson motorcycle that Leno is using to raise money for the victims of Hurricane Katrina at NBC studios on 9 September 2005 in Burbank, California Bill Cosby: Career in pictures Bill Cosby Bill Cosby speaks during a taping of 'Meet the Press' at the NBC studios on 14 October 2007 in Washington Bill Cosby: Career in pictures Bill Cosby Bill Cosby at the 12th annual Mark Twain Prize for American Humor at the John F. Kennedy Center on 26 October 2009 in Washington Bill Cosby: Career in pictures Bill Cosby Bill Cosby speaks at the National Action Network's 20th annual Keepers of the Dream Awards gala in New York on 6 April 2011 Reuters Bill Cosby: Career in pictures Bill Cosby Bill Cosby during the 100th anniversary celebration of the Beverly Hills Hotel & Bungalows supporting the Motion Picture & Television Fund and the American Comedy Fund, 2012 Getty Images Bill Cosby: Career in pictures Bill Cosby Bill Cosby speaks onstage at the Thurgood Marshall College Fund 25th Awards Gala on 11 November 2013 in Washington Bill Cosby: Career in pictures Bill Cosby Bill Cosby performs at the Treasure Island Hotel & Casino on 26 September 2014 in Las Vegas

Ms Constand was present in the courthouse alongside many women who have also accused Cosby of sexual assault. Ms Constand is the only woman who has been able to take her accusations to criminal court thus far.

“He thought he could bury us. He didn't know we are seeds... uncovering the rape culture in this country,” Linda Kirkpatrick, who has also accused Cosby of sexual assault, said in defiance.

Another accuser, Victoria Valentino, said that she and others were “devastated” by the mistrial.

When the mistrial was announced, both Cosby and Ms Constand were in the courthouse. Ms Constand sat stoically in the front row of the room, alongside her mother and a detective. Cosby clutched to a cane as the decision was announced, moving very little during the announcement before leaving the court.

“How do I describe the District Attorney? Heinously and exploitatively ambitious,” Camille Cosby, Cosby’s wife, said in a statement. “How do I describe the judge? Overtly and arrogantly collaborating with the District Attorney”.

Cosby’s publicist said that the mistrial was vindication, and said that the decision “restored” his client’s power.

The case against Cosby surrounds allegations by Ms Constand that he had invited her to his Pennsylvania home in 2004, before drugging her and sexually assaulting her. Ms Constand attests that Cosby gave her three blue pills that left her virtually paralysed and unable to defend herself against Cosby’s assaults. Cosby has vehemently rejected any claims that his interactions with Ms Constand were anything but consensual. He has denied any wrongdoing in response to other allegations as well.

Still, the allegations have taken a heavy toll on Cosby.

The man once known as “America’s dad” for his role in television programmes that broke ground in the US portraying a black man as a successful and caring father, has been stripped of several honours he has received. Honorary degrees granted to him have been revoked in the past several years as allegations of sexual misconduct have swirled. Potentially lucrative business deals have fallen apart for the celebrity comedian as well.

At the time of the alleged assault, Ms Constand was an operations manager for the women’s basketball program at Temple University, where Cosby was the most notable alumnus and a member of the board of trustees. The two had a friendly relationship, and Ms Constand viewed Cosby as a trusted mentor and father figure. She did not file a report on the assault for more than a year following the alleged incident.

While the allegations were repeatedly attacked by Cosby’s lawyers, who noted inconsistencies in her accusations, the case seemed unlikely to land in court during the mid-2000s. But nearly a decade later a series of improbable events led to trouble for the celebrity.

It started with a fellow comedian.

In a routine that went viral, comedian Hannibal Buress delivered a stinging rebuke in 2014 to comments from Cosby that black Americans needed to act more maturely and civilly, all but blaming them and their actions for the circumstances surrounding black people in the United States. Mr Burress noted that Cosby was perhaps not a saint himself, and brought up the longstanding accusations of Ms Constand against him of sexual assault.

The result of that viral bit was that other women who say they’ve been assaulted by Cosby came forward. The following two years or so saw accusations upon accusations that Cosby had sexually assaulted women.