The California Supreme Court has reversed a Santa Clarita woman’s death sentence for murdering her four young daughters in an arson fire at the family’s home more than two decades ago.

The state’s highest court upheld Sandi Dawn Nieves’ conviction for the killings, but cited the “trial court’s misconduct” in overturning the 57-year-old woman’s death sentence for the July 1, 1998, killings of Jaqlene Marie Folden, 5, Kristl Dawn Folden, 7, Rashel Hollie Nieves, 11, and Nikolet Amber Nieves, 12, who died from inhaling soot, smoke and carbon monoxide.

“Although we conclude that the court’s misconduct could not have altered the jury’s guilt determination, we are unable to reach that conclusion regarding the penalty trial, thus finding prejudicial misconduct that requires reversal of the penalty judgment,” Chief Justice Tani Gorre Cantil-Sakauye wrote on behalf of the panel in its unanimous ruling.

Superior Court Judge L. Jeffrey Wiatt—who has since died—allegedly made “inappropriately disparaging and sarcastic remarks to defense counsel, impugning his performance, chastising him for improper behavior, and sanctioning and citing him for contempt in front of the jury,” according to the panel’s 143-page ruling.

“The trial judge also directed improper comments and questions to witnesses, openly doubting the credibility of one defense expert by asking argumentative and hostile questions and remarking on the possibility that another defense expert ‘just doesn’t know what he’s talking about.’ In the penalty phase, the trial judge needlessly reprimanded and belittled a lay witness who testified for the defense,” according to the ruling.

Los Angeles County District Attorney George Gascon—who has said he has a “mandate from the public—said in a directive shortly after he was sworn into office last December that a death sentence is “never an appropriate resolution in any case.”

Jurors convicted Nieves of first-degree murder for the deaths of her daughters, along with one count each of arson and the attempted murder of her son, David, who testified against her.

The jury also found true the special circumstance allegations of multiple murders, murder while lying in wait and murder during an arson.