Joshua Sudock/Pool / Reuters The office of Orange County District Attorney Tony Rackauckas is entangled in a case involving the use of jailhouse informants and secret jail records.

LOS ANGELES ― A California appeals court affirmed an Orange County Superior Court judge’s decision last year to remove the county’s entire district attorney’s office from a high-profile mass murder case that has become embroiled in a scandal over a jail informant program.

The case involves Scott Dekraai, who pleaded guilty to killing his ex-wife and seven other people at a Seal Beach hair salon in 2011. The investigation into the jailhouse informant program arose when Dekraai’s lawyer found that his client had been put in a cell next to a known snitch. Since then, the scope and secrecy of the Orange County Sheriff’s Department informant program not only became the 800-pound gorilla in the Dekraai case but has also raised questions about decades worth of criminal convictions in Orange County.

In an opinion released Tuesday, the 4th District Court of Appeal said that Judge Thomas Goethals’ 2015 recusal of the Orange County District Attorney’s Office from Dekraai’s case was appropriate, citing a “disqualifying conflict of interest,” supported by evidence that came out during multiple hearings, which demonstrated that the DA’s office was more interested in being loyal to the county’s sheriff’s office than in upholding the law, and that this misplaced loyalty came at the expense of Dekraai’s rights.

The court also noted that the OCDA’s “substantial” failures in turning over evidence showed that it “cannot be relied upon to comply” with its obligations in the Dekraai case moving forward.

The unanimous three-justice panel also excoriated California Attorney General Kamala Harris for arguing that the recusal of the OCDA from Dekraai’s penalty phase was “a remedy in search of a conflict.”

“Nonsense,” the court responded. “The court recused the OCDA only after lengthy evidentiary hearings where it heard a steady stream of evidence regarding improper conduct by the prosecution team. To suggest the trial judge prejudged the case is reckless and grossly unfair. These proceedings were a search for the truth.”

The court also criticized Harris’ office for arguing that all the accusations rest solely on the shoulders of the sheriff’s department and that the DA’s office is not to blame for an informant program inside the county jails.

There’s no “legitimate reason” for the sheriff’s department “to create and maintain such a sophisticated, synchronized, and well-documented [informant] program other than to obtain statements that will benefit prosecutions,” the opinion reads. Given the benefit the DA’s office received from the informant program, “it would not be unreasonable to conclude the OCDA was aware of the program and at the very least should have inquired about [informant] housing and movements.”

In October, Deputy Attorney General Theodore Cropley conceded that there is no evidence that the district attorney’s office ever questioned the sheriff’s department about the existence of a computerized database that tracked the movements of jail inmates and informants.

The story of Goethals’ recusal begins in mid-2014, when the judge permitted a second round of hearings regarding jailhouse informant evidence against Dekraai, accused of the deadliest mass murder in Orange County history.

Goethals’ decision came after Assistant Public Defender Scott Sanders discovered that the sheriff’s department had been documenting the movements of jail inmates and informants for at least two decades but had kept those records concealed.

The records showed that at least two sheriff’s deputies had “either intentionally lied or willfully withheld information” from the court during proceedings against Dekraai, Goethals ruled. The judge also admonished the district attorney’s office for failing to turn over the computerized records after almost two years of repeated court orders.

The significance of that deception led to Goethals’ decision to boot the entire district attorney’s office from the Dekraai case.

But another bombshell came in early 2016, when a 1,157-page secret database surfaced ― a log that was maintained by sheriff’s deputies who work in a branch of the department called “special handling,” which specifically deals with inmates and jail informants. The database, which described years’ worth of interactions with inmates and informants, shed new light on the scope of the informant program in the county.

Once this huge database was discovered, the district attorney’s office finally acknowledged that, yes, an informant program did exist and that sheriff’s deputies had actively “recruited and utilized” informants and rewarded them in exchange for information.

The DA’s office also admitted that the database contradicted statements made by multiple witnesses, including several members of law enforcement in the county, who’d testified in the Dekraai case.

However, Sanders argues that the deception goes well beyond deputies in the jail. He contends that it points toward a cover-up that extends far up the chain of command. The sheriff’s department has denied that any command staff knew about the informant database before 2016 ― even though Sanders cites evidence that at least one commander, Jon Briggs, had served as supervisor of the “special handling” deputies when the secret database was used.

Sanders should have received a copy of the database years ago, when a court ordered the Orange County Sheriff’s Department to turn over just this kind of material. Indeed, Goethals has blasted Orange County Sheriff Sandra Hutchens over the lengthy delay in turning it over.

Much of the contents remain unknown publicly because of a protective order placed on the database since pages from it began to trickle out from the sheriff’s department months ago. About 200 pages of the 1,157-page database are expected to be released by Goethals in early December.

It’s still unclear why use of this database was abruptly halted just days after Goethals issued a broad order to turn over such information. It’s also unknown if a new logging system replaced the old one after it ended in 2013. Lt. Mark Stichter, a sheriff’s department spokesman, told The Huffington Post recently that the agency is still trying to determine why the database ended.

Then, just this month, Goethals read aloud a disturbing entry in the database that appears to point to the existence of a still newer log, one that has yet to be turned over:

“A Special Handling meeting was held with sergeants Ramirez and Wert. Numerous topics were discussed. One of the biggest changes will be concerning this log. It will NO LONGER BE A LOG, but rather a document of IMPORTANT INFORMATION SHARING ONLY.”

Meanwhile, the sheriff’s department continues to deny that a formal jail informant program even exists.

Sanders alleges that in multiple Orange County cases, informants held recorded and unrecorded conversations with inmates who were represented by lawyers. This would be a violation of an inmate’s right to counsel. Prosecutors are accused of taking damning evidence gathered by the informants and presenting it in court, while withholding evidence that could benefit the defense.

Sanders’ discoveries have caused multiple murder cases in the county to unravel, with some accused murderers even having their sentences vacated.

It remains unclear exactly how many Orange County cases may have been tainted by the informant evidence, but Sanders has argued that every case involving a jailhouse informant in Orange County over the last 30 years deserves to be re-examined.

The Orange County District Attorney’s Office did not immediately respond to a request for comment.