A judge on Thursday yanked the Orange County district attorney's office off the case of a convicted mass killer after finding sheriff's deputies lied or withheld information about the use of jailhouse snitches used to gather evidence for prosecutors.

Judge Thomas M. Goethals turned over the case of Scott Dekraai to the California attorney general's office after concluding that two sheriff's deputies "either intentionally lied or willfully withheld material evidence" on the stand and that the county prosecutor is responsible for their actions.

The ruling dealt a blow to prosecutors' efforts to impose the death penalty on 45-year-old Dekraai, a former tugboat operator who pleaded guilty to killing his ex-wife and seven others in a 2011 shooting rampage at a Seal Beach hair salon. Defense attorneys wanted the death penalty thrown out but Goethals refused.

While Goethals' ruling is limited to Dekraai, the extensive hearing into the use of jailhouse informants in Orange County raised many questions about how evidence is gathered and used. Defense attorneys in other cases may raise similar claims based on what was revealed.

The ruling followed a yearlong courtroom duel over allegations that authorities misused jailhouse informants, hid evidence and lied on the witness stand.

Paul Wilson, whose wife Christy was killed in the onslaught, said he was stunned and angered by the judge's decision. He said while he felt prosecutors were not to blame, he wished they'd let the state move the case forward for the sake of victims' families.

"My nightmare continues," Wilson told reporters. "None of the other stuff that's involved — the jailhouse informants talking to somebody, the evidence the sheriffs withheld or did not withhold — who cares? The fundamentals of the case is that he killed those eight people that day and he needs to pay for that."

In his ruling, Goethals also limited the evidence that can be presented during the penalty phase of Dekraai's case, noting key jail housing records were not turned over to Dekraai's lawyer for nearly two years.

"In this case, the District Attorney's conflict of interest is not imaginary. It apparently stems from his loyalty to his law enforcement partners at the expense of his other constitutional and statutory obligations," Goethals said in the order, which he stayed to allow time for an appeal.

Dekraai's lawyer, Scott Sanders, declined to immediately comment on the ruling. The state attorney general's office is also reviewing it, said David Beltran, an agency spokesman.

Assistant District Attorney Dan Wagner said his office was still deciding whether to appeal and regretted that victims' families would suffer another delay.

"It's a very rare thing for a prosecutor's office to be recused. It's a high standard and respectfully we disagree that the defense has met that standard," Wagner told reporters.

He declined to discuss Goethals' findings about deputies.

Last year, Sanders, an assistant public defender, accused prosecutors of trying to cover up a jailhouse informant program that had trained snitches to sidle up to high-profile defendants and elicit information in violation of their constitutional rights.

After months of testimony, the judge barred prosecutors from using an informant's testimony and found they failed to turn over crucial evidence about the snitch to Dekraai, but let the case proceed.

The case was heading toward the penalty phase when Sanders uncovered jail records that he believed could explain how authorities had used the snitch to chat up Dekraai. It also raised questions for him about why prosecutors had failed to turn over evidence and the honesty of sheriff's deputies, who did not previously disclose the existence of the records during testimony about how inmates' movements were tracked.

Lt. Jeff Hallock, a spokesman for the Orange County Sheriff's Department, said the agency was disappointed but will continue an internal investigation into the allegations that deputies lied.

Kate Corrigan, who helped start Orange County's criminal defense bar association, said she hopes the state will not only take on the Dekraai case but investigate the allegations.

"The DA's office was the only law enforcement agency looking into whether violations of the constitution had occurred," she said. "Now, we no longer have the fox tending the hen house."

___

Associated Press Writer Gillian Flaccus in Tustin, California, contributed to this report.