Bill Cosby was once known to millions as "America's Dad", but the comedian has now been sentenced to three to 10 years in jail after being convicted of sexual assault.
His role as the benevolent, jumper-wearing Dr Cliff Huxtable in 1980s hit sitcom The Cosby Show made him a national treasure in the US.
But more than a dozen women accused Cosby of misconduct, and one case made it to court.
The jury failed to reach a verdict in June 2017, but a retrial led to his conviction less than a year later.
How did this man, a household name for so long in America, rise and fall so far?
How did his career begin?
Born in 1937 in a housing project in Philadelphia to parents who were far from financially well-off, the young William Henry Cosby Jr shone shoes and worked at a local supermarket to help his family make ends meet.
His early life was touched by tragedy when one of his four brothers died and he, the oldest, became a father figure.
Accounts of his school years portray a joker and a storyteller who loved to entertain his classmates. After school he joined the US Navy, then went to university and had a part-time job as a bartender.
It was here that he found his way in to comedy, filling in for a club comedian and laying the path for his future fame.
His debut on NBC's The Tonight Show in 1963 led to a recording contract with Warner Brothers, and the release of a series of award-winning comedy albums.
On one of those, 1968's To Russell, My Brother, Whom I Slept With, he established the themes that would define his work - the father as a loving disciplinarian; siblings who could plot together one minute, then scream blue murder the next; and a confidence in the bonds of family.
The album sleeve noted: "During his time on stage, Cosby never once told a joke. He didn't sing or dance or do tricks. All he did was talk" - but the performer had the 10,000-strong audience in the palm of his hand throughout.
By the time the album was released, Cosby was already a TV star.
What boundaries did Cosby break as a black actor?
In 1965, he had become the first black actor to star in a drama series, when he was cast in the espionage show I Spy.
He played Alexander Scott, an undercover agent posing as a tennis instructor, alongside Robert Culp, who played fellow agent Kelly Robinson.
Cosby wasn't originally in line for the role, which was intended for an older actor, but producer Sheldon Leonard had been wowed by the comedian's stand-up routine and decided to rewrite the show as a buddy comedy.
Premiering during a time of great upheaval for race relations in the US, it was banned by some stations in the southern states. But Cosby went on to earn three consecutive best actor Emmys for his role - a record that still stands.
Despite his prominence on TV, Cosby made a conscious decision not to directly address race relations in his act - preferring a more subtle challenge to the status quo.
"A white person listens to my act, and he laughs, and he thinks: 'Yeah, that's the way I see it, too,'" he once said.
"OK. He's white. I'm Negro. And we both see things the same way. That must mean that we are alike. Right?
"So I figure this way, I'm doing as much for good race relations as the next guy."
The Cosby Show, which was launched by NBC in 1984 and aired for eight seasons, was his biggest success and established him as a household name.
Based on his stand-up routines, Cosby's portrayal of an educated, affluent doctor - Heathcliff "Cliff" Huxtable - and the trials of raising five young children drew parallels with his own life.
His TV wife, Claire, was loosely based on his own wife Camille, whom he married in 1964.
One of the most popular shows of the 1980s, the sitcom was watched by about 30 million viewers each week. By 1989, its star was earning $4m (£2.5m) a month in syndication rights alone.
When the show was cancelled in 1992, Cosby embarked on a number of projects including film roles, but was never able to emulate the success of his star vehicle.
In 2013, he received rave reviews for his first TV stand-up show in 30 years, which led to a national tour.
But his comeback fell apart as several women came forward with allegations of sexual assault going back almost 30 years.
What were the allegations?
The accusations first surfaced in 2005, when Andrea Constand, a staff member at Cosby's former university, said she had been drugged and molested by the star at his home a year earlier.
Prosecutors declined to press charges, citing lack of evidence, but Ms Constand filed a civil case against the comedian.
Thirteen women, 12 of whom remained anonymous, agreed to be witnesses, each with a similar account of sexual assault.
Cosby denied the accusations, which his lawyer called "preposterous", and the case was settled out of court in 2006 for an undisclosed sum.
In subsequent years, some of Ms Constand's fellow witnesses came forward and told their stories to the media. But the accusations were not comprehensively reported until Cosby's planned TV comeback thrust him back into the limelight.
More than 50 women accused the star of sexual assault or rape, but due to time limits on cases in the US, only one - Andrea Constand - took the case to criminal court.
Cosby's lawyers consistently denied the charges, calling them a "media frenzy" and asking why the women had not made legal complaints at the time when they said they were assaulted.
In 2014 Cosby said he had not addressed the allegations in public because "a guy doesn't have to answer to innuendos".
But shortly afterwards, previously unseen court papers from 2005 came to light and showed he had admitted obtaining sedatives to give to young women he wanted to have sex with.
The sedatives, called Quaaludes, render people unable to move.
The accusations disrupted his hopes of a return to show business. Cable station TV Land pulled repeats of The Cosby Show, some of his stand-up shows were called off and protesters showed up to the ones that he still put on.
His statue was removed from the MGM Hollywood Studios park in Florida, and several colleges removed honorary degrees they had given him.
His portraits were taken down from the walls in his alma mater, Temple University in Philadelphia, and he resigned from the board of trustees.
What happened when the case came to criminal court?
At first, it appeared unlikely that criminal action would be taken against Cosby for any of the alleged incidents, partly because the statute of limitations applies to cases of rape and sexual assault in most US states. That means there is a time limit on cases.
However, one case came to criminal trial: that of Andrea Constand.
The case was seen as one of the biggest US celebrity court case since the murder trial of former American football player OJ Simpson in 1995.
In June 2017, Ms Constand told her story in court for the first time, having previously been barred from doing so due to a 2006 settlement.
She said Cosby had given her pills that he claimed were herbal and said would "take the edge off", but which left her "frozen".
"In my head, I was trying to get my hands to move or my legs to move, but I was frozen", she said.
About 20 minutes later, she said, he put his hand on her genitals.
"I wasn't able to fight it in any way," she told the court. "I wanted it to stop."
Cosby continued to deny the allegations. He did not give evidence in court but had one witness. In the end, with Cosby possibly facing the rest of his life in prison if found guilty, the jury was deadlocked, and a mistrial was declared in June 2017.
How was the retrial different?
The retrial, which began on 9 April, took place in a changed atmosphere.
A flood of sexual misconduct accusations starting last October against powerful men in the entertainment industry such as Harvey Weinstein and Kevin Spacey triggered the #MeToo movement.
The Cosby trial became one of the first celebrity trials of the #MeToo era, and the decision by the judge to allow five more women to testify against him was seen as a key development.
On this occasion, the jury of five women and seven men took two days to find the comedian guilty on all three counts of sexual assault. Months later, he was sentenced to a total of three to 10 years in a state prison.