The 2005 press release by the district attorney in which he pledged to not file charges, led to the decision to throw out the conviction.After being released from prison, Matt Slocum / AP Bill Cosby reacts in front of his house on June 30, 2021.On Wednesday afternoon Bill Cosby was released from prison. He was two years into a sentence that was supposed to last three to ten years. This was after he was convicted of raping Andrea Constand in his home in 2004. The conviction was overturned by the Pennsylvania Supreme Court hours earlier. What was the result? What happened? The court determined that Cosby's criminal case was flawed because a prior district attorney had stated a decade ago that Cosby would not face prosecution. This announcement set off a chain of events, including Cosby giving incriminating information against him in a civil suit. These details eventually became part the criminal prosecution that he had been under the impression would never occur. This is an unusual situation, which, as Wednesday's court decision noted, is not precedent. It wasn't that Bruce Castor, then-Montgomery County District Attorney, had made an unusual public pledge outside of the normal immunity agreement process. Castor's public pledge was not rescinded by a later district lawyer. The court found that Cosby's decision to incriminate himself in civil proceedings using Castors testimony and then to have those statements used against his back ran afoul with his due process rights. It was so outrageous that it was impossible to correct the whole case. This remedy is both rare and severe, which we don't dispute. It is justified here and even compelled. Justice David Wecht wrote in support of the majority. The prosecution of crimes is a matter of great importance to the society. However, it is true that this interest cannot outweigh society's desire to protect constitutional rights. Castor learned that Constand had given Constand pills that had caused Constand's incapacity and made her sexually assaulted. Castor was not convinced that Constand's office could prove his case in court, given the fact that Constand waited over a year before filing her complaint with law enforcement. Castor also believed Constand's recollections were less accurate than the forensic evidence. Castor spoke to the Cosbys team, and also stated in a February 2005 press statement that he would not be facing criminal charges for Constand's allegation. Castor, who defended Donald Trump during his February impeachment trial, later stated that his intention was to help Constand get justice. Castor believed that by taking the criminal case off the table, Cosby would be unable to invoke his Fifth Amendment right against self incrimination in Constand's civil lawsuit. Now fast forward a decade. After dozens of women made similar allegations against Cosby in 2015, Constands civil case documents were released in response to a media request. Risa Vetriferman, the district attorney, opened the criminal investigation that had been closed by her predecessor. Castor wrote Ferman warning her about Cosby's public promises. Ferman chose to continue. Kevin Steele, her successor, officially charged Cosby with three counts each of aggravated assault in December 2015. In April 2018, a jury found Cosby guilty. Cosby was found guilty by a jury in April 2018. He was sentenced to a lengthy prison term and was required to register as an adult predator.Matt Slocum / AP Montgomery County district attorney Kevin Steele speaks at a news conference following the conviction of Bill Cosby in his sexual assault case.Castor later stated that he intended to prevent local prosecutors from charging Cosby with criminal offenses related to Constands' allegations in the future. Castor did not obtain Constand's consent for this decision or communicate his promise to Constand and her lawyers. It was reported by a reporter that she learned of it. Also, he didn't negotiate an immunity agreement with Cosby or present it to a court to obtain an official order which would have legal force for the district attorneys office moving forward. Castors' statement was, instead, a unilateral exercise in prosecutorial discretion, according to the Pennsylvania Supreme Court. He also didnt negotiate an immunity agreement with Cosby and present it to a judge to get an official order that would be legally binding on the district attorneys office going forward. Constand's civil lawsuit ended with Cosby sitting for four depositions. During these depositions, he admitted to numerous incriminating acts including giving Constand Benadryl to sex and providing quaaludes. Constand eventually settled the case for $3.38million. The state Supreme Court, however, had a different interpretation than Constand's legal weight of Castors announcement. Even though there hadn't been an immunity agreement formalized, it was a $3.38 million settlement. Wecht wrote that a prosecutor can make an unconditional promise not to prosecute a defendant, but that the defendant may rely on that guarantee to the disadvantage of his constitutional right to not testify. The principle of fundamental fairness, which undergirds the criminal justice system, requires that that promise be kept. BuzzFeed News was informed by two former prosecutors that it is quite common for prosecutors not to plan to bring charges against defense attorneys. They said that officials don't usually release press releases about it. Michael Levy, a former assistant US Attorney in the Eastern District of Pennsylvania who is now a law professor at Penn, stated that he had been a prosecutor for over 40 years. He would certainly tell, or even write, to defense lawyers periodically to say we would not prosecute right away. That would have meant that no matter what, we would not proceed with the criminal case. I wouldn't have believed that. This is incredibly unusual, Shan Wu, a former federal prosecution, said. Cosby relied on this to say that, OK. If Im not in any danger, then I can testify to the civil case. Wu, however, also questioned Cosbys decision to allow him to testify, despite Castors press release.After the first day of his 2018 sexual assault trial sentencing, Pool / AP Bill Cosby left the Montgomery County Courthouse.