Much has been said and written about the sex scandal that has torpedoed Bill Cosby's legacy -- so much so that it can be difficult to recall how he reached the point of facing trial on three counts of felony aggravated indecent assault.
Here's a look at the allegations that formed the basis of the charges and how they snowballed more than a decade later into lawsuits, cover stories, and a national conversation on sexual assault.
Lawyers for Cosby, 79, have said throughout that their client is innocent of all accusations.
Sexual advances become assault allegations
The case that ended Saturday in a mistrial involved Andrea Constand, the first person to publicly accuse Cosby of sexual assault. Prosecutors say they will retry the case. Before the trial, a probable cause affidavit laid out her version of events, which she says occurred between mid-January and mid-February of 2004.
Constand knew Cosby through her job at Temple University in Philadelphia, and he invited her to his Cheltenham home. Over two visits, she said, he touched her "without warning" and tried to unbutton her pants before she stopped him. The incidents made her uncomfortable, but she continued to trust him because of who he was, the affidavit said.
In another visit he gave her a mix of pills and wine that left her feeling "frozen" and "paralyzed" as he fondled her body and placed his hand on his genitals, the affidavit said. She woke up the next morning in his home with her sweater bunched up and her bra undone, the affidavit says. She said she found Cosby at the bottom of the stairs; he gave her a muffin before opening the door and letting her out.
Constand returned to her parents' home in Canada three months later. Her parents noticed a change in her personality and that she had trouble sleeping. It took Constand almost a year to confide in her parents what happened, and they reported the incident to police in January 2005.
Cosby told investigators in Pennsylvania that he gave Constand Benadryl and that the encounter was consensual. He described their previous encounters as "social and romantic."
In a February 17, 2005, news release, former District Attorney Bruce Castor Jr. said no criminal charges were forthcoming but he would "reconsider" the decision "should the need arise," according to the affidavit.
The next month, Constand filed a lawsuit claiming battery, sexual assault, intentional infliction of emotional distress and other claims. The case was settled in March 2006 after months of depositions that would come back to haunt Cosby.
Accusers surface, fallout begins
Former teen actor Barbara Bowman told her story to many media outlets in the years after Constand went public. So did California lawyer Tamara Green and other Jane Does named in Constand's lawsuit.
But only after a man, comedian Hannibal Buress, called Cosby a rapist in a stand-up act in October 2014 did "public outcry begin in earnest," Bowman wrote in a Washington Post op-ed, repeating allegations that Cosby drugged and raped her.
Indeed, Buress is widely credited with recasting the spotlight on the rape allegations for a new audience: the social-media generation. The fallout was swift and devastating, with at least 50 accusers coming forward.
As those accusers, including model Janice Dickinson and journalist Joan Tarshis, shared similar allegations, a series of public relations blunders cast a long shadow over the beleaguered Cosby.
He dismissed questions about the allegations during an Associated Press interview in 2014 and pressed the reporter not to let the public see or hear his answers to the questions. The AP didn't publish the video right away, but it released it two weeks later as the accusations grew.
Then, a Twitter meme campaign by the Cosby team went awry.
NBC and Netflix ditched projects involving him while TV Land removed reruns of "The Cosby Show" from its programming schedule.
Cosby's alma mater, the University of Massachusetts at Amherst, cut ties with him, the first in what would become a long list of organizations to do so.
Even the former district attorney in the Constand case piled on, saying he thought Cosby lied to authorities.
All the while, Cosby maintained his innocence through his lawyers, who called the accusers liars and opportunists.
"The fact that they are being repeated does not make them true," said John P. Schmitt, calling the allegations "decade-old" and "discredited."
"Mr. Cosby does not intend to dignify these allegations with any comment."
The statement came the day after NPR broadcast an awkward interview with Cosby -- awkward because Cosby did not utter one word when repeatedly asked about the charges against him.
NPR host Scott Simon filled the airtime by saying Cosby was just "shaking his head no."
The attempts to discredit accusers eventually led to lawsuits and countersuits from Cosby.
Tamara Green, the next woman to publicly accuse Cosby after Constand, filed a defamation suit. Six more women eventually joined: Therese Serignese, Linda Traitz, Louisa Moritz, Barbara Bowman, Joan Tarshis and Angela Leslie. With the help of attorney Gloria Allred, they compelled Cosby's wife, Camille Cosby, to sit for a deposition.
Bill Cosby countersued them in December 2015, saying they defamed him.
Cosby faces another defamation lawsuit from Dickinson, along with a sexual harassment claim from Judy Huth, who alleges Cosby sexually assaulted her in 1974, when she was 15.
Judge unseals deposition
It was the statement Cosby made in a deposition to Constand's lawyers in his lawsuit in 2005 that led Pennsylvania prosecutors to charge him in the Constand case. Cosby admitted under oath that he procured sedatives for the purpose of giving them to young women with whom he wanted to have sex.
The records were made public in July 2015, after The Associated Press went to court to compel their release.
According to the documents, lawyer Dolores Troiani asked Cosby: "When you got the Quaaludes, was it in your mind that you were going to use these Quaaludes for young women that you wanted to have sex with?"
Cosby answered yes.
The revelations led newly elected Montgomery County District Attorney Kevin Steele to seek charges. He had earlier made the Cosby case an election issue.
Cosby was arraigned in December 2015. After a preliminary hearing, a judge decided there was enough evidence for him to stand trial.
Jury can't reach decision
Cosby's trial started June 5 in Norristown, Pennsylvania. He pleaded not guilty to three counts of aggravated indecent assault on Constand at his home near Philadelphia in January 2004.
Under Pennsylvania law, Cosby was accused of penetrating someone with part of his body without that person's consent. The charge also could include taking away a person's ability to refuse penetration by holding them down or drugging them or carrying out a sex act when the person is unconscious.
Prosecutors argued Cosby drugged and sexually assaulted Constand. He faced a maximum sentence of 10 years in prison for each count.
The jury was made up of four white women, six white men, one black woman and one black man; Cosby is black. Jurors were bused to Norristown from Allegheny County, near Pittsburgh, and were sequestered in a hotel.
They deliberated for 52 hours over six days. They told Judge Steven O'Neill on the fourth day that they could not reach a unanimous verdict. He ordered them to keep trying but declared a mistrial June 17, the sixth day of their deliberations.
What's next for Cosby?
Prosecutors immediately said they would seek a retrial.
In the meantime, pending federal and state lawsuits could lead to monetary awards against Cosby. Three are defamation cases in which accusers say Cosby defamed them as liars, and two are civil assault lawsuits.
Before the trial, Cosby told CNN's Michael Smerconish that he wants to return to comedy and activism.
He also said he knew he would face public scrutiny regardless of how the trial ended.