The Pennsylvania Supreme Court’s decision to overturn Bill Cosby’s sexual-assault conviction has sparked a rare public war of words between the court’s chief justice and Montgomery County prosecutors.

In an interview Sunday with Harrisburg’s WHTM-TV, Chief Justice Max Baer justified the ruling that freed Cosby earlier this month by calling prosecutors’ conduct in the case “reprehensible.”

Within hours, Montgomery County District Attorney Kevin R. Steele, who led the trial team, shot back, accusing Baer in a statement of spreading “misinformation.” Steele also said his office continues to review its options for challenging the court’s decision.

The falling-out — much like the court’s 6-1 ruling — centered on a deal supposedly struck in 2005 between Cosby and one of Steele’s predecessors, Bruce L. Castor Jr., in which Castor agreed the office would not prosecute the comedian for sexually assaulting Andrea Constand in 2004 if Cosby agreed to testify in her civil case against him.

Such an agreement was never memorialized in writing and never publicly discussed until the District Attorney’s Office charged Cosby a decade later with drugging and attacking Constand.

Baer on Sunday criticized prosecutors for going back on Castor’s word, calling the decision to charge him a “reprehensible bait-and-switch.”

“Nobody is sympathetic to Bill Cosby,” Baer said in the interview. He said the court was compelled to make the decision it did, barring a retrial and ordering him released after two years in prison, “to protect 13 million Pennsylvanians from that type of illegal conduct.”

The segment was remarkable not only for Baer’s condemnation of prosecutors’ actions but also because justices rarely grant interviews to discuss their decisions.

“The general rule,” Duquesne University law professor Bruce Ledewitz said, “is that anything a judge has to say is on the piece of paper called the opinion.”

What’s more, Baer, a former deputy attorney general from Pittsburgh who became chief justice in April, misstated several aspects of the record and appeared to misunderstand one of the most central questions at the heart of the case.

“There was no controversy whatsoever that this deal was made,” he said at one point. “It was memorialized in emails. It was memorialized in press conferences.”

In fact, controversy over whether the deal ever existed prompted months of pretrial wrangling in the case, chiefly because there was no prior evidence — in emails or in news conferences — of any such agreement before Cosby’s arrest in December 2015.

» READ MORE: Bill Cosby’s release from prison hinged on Bruce Castor’s word. But the ex-DA hasn’t always been consistent.

The same issue even came before the Supreme Court in 2016 — two years before Cosby’s conviction. At the time, the justices, including Baer, refused to take the appeal and allowed the case against Cosby to move forward, tacitly endorsing a ruling by a Montgomery County judge who concluded that Castor’s descriptions of the purported agreement were inconsistent, not credible, and ultimately suggested no deal had been made.

“There has been a tremendous amount of misinformation about what actually took place in this criminal prosecution,” Steele said in a statement Sunday, specifically referencing Baer’s TV interview. “To be very clear, prosecutors in this case did not believe there was an agreement not to prosecute or immunity for the defendant at the time we moved forward on the case, and we do not believe it now.”

In testimony he gave for Cosby’s defense in 2016, Castor said he doubted a jury would believe Constand’s story when she first reported her alleged assault in 2005.

So instead of filing charges, he said he agreed not to pursue a criminal case so the comedian could not invoke his Fifth Amendment rights against self-incrimination and would ultimately testify in Constand’s civil case, which eventually settled for $3.4 million.

The first written reference to any such agreement emerged in an email Castor sent to Risa Vetri Ferman, his former first assistant district attorney, in September 2015, as her office was building its case against Cosby. Castor advised Ferman not to proceed with the prosecution and copied the comedian’s lawyers on the email.

At the time, Castor was locked in a bitter campaign to reclaim his old job against Steele, who had sharply criticized Castor’s 2005 decision not to charge Cosby. And contrary to what Castor later said on the witness stand, he maintained in interviews during that race that he would reconsider prosecuting Cosby if reelected.

Ferman, who had been the office’s primary contact with Constand and her lawyers a decade earlier, told Castor in an emailed response that she had no recollection of any non-prosecution agreement. And attorneys for Cosby and Constand didn’t have any written records of one.

In fact, despite Castor’s claims to have made the deal to benefit Constand in her civil case, her lawyers said he did not tell them about it or his decision not to charge Cosby, which they maintain they only learned of through a 2005 news release by his office.

Castor cited that news release as a defense witness in the Cosby case in 2016. It makes no mention of any agreement or that Cosby was forever protected from prosecution over the Constand allegations, as Castor later claimed. Instead, the DA cautioned in it that he would “reconsider this decision should the need arise.”

Pressed on that phrase while testifying for Cosby, Castor maintained it didn’t refer to his decision not to prosecute — as Steele and the prosecution team said — but rather his decision not to hold a news conference to discuss the deal he made.

» READ MORE: Bill Cosby’s release from prison again shines a light on Bruce Castor. And Castor feels ‘vindicated.’

In its decision to overturn Cosby’s conviction earlier this month, the Supreme Court took Castor at his word that an oral agreement existed, even as it acknowledged the confusion around the issue.

The majority concluded that prosecutors’ decision to use Cosby’s deposition testimony from Constand’s civil case at his 2018 criminal trial violated the terms of the supposed deal and the comedian’s due process rights — a transgression four of the justices deemed so severe that they barred Steele’s office from retrying Cosby again without the deposition testimony.

Baer was not one of them. He joined Justice Kevin R. Dougherty in a dissent urging a retrial. And in his interview Sunday, he said he supported legislation put forth after the court’s ruling to require all future immunity or non-prosecution deals to be memorialized in writing.

“We certainly didn’t find Bill Cosby not guilty or find him innocent,” the chief justice said. “What we found was that what the state did was inappropriate.”

A spokesperson for the justices said Monday that Baer was not available to comment on Steele’s response.

Steele said he stands by his decisions.

“The Montgomery County District Attorney’s Office,” he said in his statement, “will continue to follow the law as we did this case and we do in every case.”