PHILADELPHIA (AP) -- Pennsylvania's highest court threw out Bill Cosby's sexual assault conviction and released him from prison Wednesday in a stunning reversal of fortune for the comedian once known as "America's Dad," ruling that the prosecutor who brought the case was bound by his predecessor's agreement not to charge Cosby.
Cosby, 83, flashed the V-for-victory sign to a helicopter overhead as he trudged into his suburban Philadelphia home after serving nearly three years of a three- to 10-year sentence for drugging and violating Temple University sports administrator Andrea Constand in 2004.
The former "Cosby Show" star -- the first celebrity tried and convicted in the #MeToo era -- had no comment as he arrived, and just smiled and nodded later at a news conference outside, where his lawyer Jennifer Bonjean said: "We are thrilled to have Mr. Cosby home."
"He served three years of an unjust sentence and he did it with dignity and principle," she added.
In a statement, Constand and her lawyers called the ruling disappointing, and they, like many other advocates, expressed fear that it could discourage sexual assault victims from coming forward. "We urge all victims to have their voices heard," they added.
Cosby was arrested in 2015, when a district attorney armed with newly unsealed evidence -- the comic's damaging deposition in a lawsuit brought by Constand -- filed charges against him just days before the 12-year statute of limitations was about to run out.
But the Pennsylvania Supreme Court said Wednesday that District Attorney Kevin Steele, who made the decision to arrest Cosby, was obligated to stand by his predecessor's promise not to charge Cosby, though there was no evidence that agreement was ever put in writing.
Justice David Wecht, writing for a split court, said Cosby had relied on the previous district attorney's decision not to charge him when the comedian gave his potentially incriminating testimony in Constand's civil case.
The court called Cosby's subsequent arrest "an affront to fundamental fairness, particularly when it results in a criminal prosecution that was forgone for more than a decade." It said justice and "fair play and decency" require that the district attorney's office stand by the decision of the previous DA.
The justices said that overturning the conviction and barring any further prosecution "is the only remedy that comports with society's reasonable expectations of its elected prosecutors and our criminal justice system."
Cosby was promptly set free from the state prison in suburban Montgomery County and driven home.
"What we saw today was justice, justice for all Americans," said a Cosby spokesperson, Andrew Wyatt. "Mr. Cosby's conviction being overturned is for the world and all Americans who are being treated unfairly by the judicial system and some bad officers."
Bonjean said Cosby was "extremely happy to be home" and "looks forward to reuniting with his wife and children." Several supporters outside yelled, "Hey, hey, hey!" -- the catchphrase of Cosby's animated Fat Albert character -- which brought a smile from him.
He later tweeted an old photo of himself with his fist raised and eyes closed, with the caption: "I have never changed my stance nor my story. I have always maintained my innocence. Thank you to all my fans, supporters and friends who stood by me through this ordeal. Special thanks to the Pennsylvania Supreme Court for upholding the rules of law."
In a statement, Steele, the district attorney, said Cosby went free "on a procedural issue that is irrelevant to the facts of the crime." He commended Constand for coming forward and added: "My hope is that this decision will not dampen the reporting of sexual assaults by victims."
"I am furious to hear this news," actor Amber Tamblyn, a founder of Time's Up, an advocacy group for sex-crime victims, said on Twitter. "I personally know women who this man drugged and raped while unconscious. Shame on the court and this decision."
But "Cosby Show" co-star Phylicia Rashad tweeted: "FINALLY!!!! A terrible wrong is being righted -- a miscarriage of justice is corrected!"
Four Supreme Court justices formed the majority that ruled in Cosby's favor, while three others dissented in whole or in part.
Peter Goldberger, a suburban Philadelphia lawyer with an expertise in criminal appeals, said prosecutors could ask the Pennsylvania Supreme Court for reargument or reconsideration, but it would be a very long shot.
"I can't imagine that with such a lengthy opinion, with a thoughtful concurring opinion and a thoughtful dissenting opinion, that you could honestly say they made a simple mistake that would change their minds if they point it out to them," Goldberger said.
Even though Cosby was charged only with the assault on Constand, the judge at his trial allowed five other accusers to testify that they, too, were similarly victimized by Cosby in the 1980s. Prosecutors called them as witnesses to establish what they said was a pattern of behavior on Cosby's part.
Cosby's lawyers had argued on appeal that the use of the five additional accusers was improper. But the Pennsylvania high court did not weigh in on the question, saying it was moot, given the finding that Cosby should not have been prosecuted in the first place.
In sentencing Cosby, the trial judge had declared him a sexually violent predator who could not be safely allowed out in public and needed to report to authorities for the rest of his life.
In May, Cosby was denied parole after refusing to participate in sex offender programs behind bars. He said he would resist the treatment programs and refuse to acknowledge wrongdoing even if it meant serving the full 10 years.
The groundbreaking Black actor grew up in public housing in Philadelphia and made a fortune estimated at $400 million during his 50 years in the entertainment industry that included the TV shows "I Spy," "The Cosby Show" and "Fat Albert," along with comedy albums and a multitude of television commercials.
The suburban Philadelphia prosecutor who originally looked into Constand's allegations, Montgomery County District Attorney Bruce Castor, considered the case flawed because Constand waited a year to come forward and stayed in contact with Cosby afterward. Castor declined to prosecute and instead encouraged Constand to sue for damages.
Questioned under oath as part of that lawsuit, Cosby said he used to offer quaaludes to women he wanted to have sex with. He eventually settled with Constand for $3.4 million.
Portions of the deposition later became public at the request of The Associated Press and spelled Cosby's downfall, opening the floodgates on accusations from other women and destroying the comic's good-guy reputation and career. More than 60 women came forward to say Cosby violated them.
The AP does not typically identify sexual assault victims without their permission, which Constand has granted.
Cosby, in the deposition, acknowledged giving quaaludes to a 19-year-old woman before having sex with her at a Las Vegas hotel in 1976. Cosby called the encounter consensual.
On Wednesday, the woman, Therese Serignese, now 64, said the court ruling "takes my breath away."
"I just think it's a miscarriage of justice. This is about procedure. It's not about the truth of the women," she said. Serignese said she took solace in the fact Cosby served nearly three years behind bars: "That's as good as it gets in America" for sex crime victims.