SACRAMENTO (AP) – The California Supreme Court on Monday upheld the conviction but overturned the 2005 death sentence for Scott Peterson in the slaying of his pregnant wife, and said prosecutors may try again for the same sentence if they wish in the case that attracted worldwide attention.

Laci Peterson, 27, was eight months pregnant with their unborn son, Connor, when she was killed. Investigators said that on Christmas Eve 2002, Peterson dumped their bodies from his fishing boat into San Francisco Bay, where they surfaced months later.

“Peterson contends his trial was flawed for multiple reasons, beginning with the unusual amount of pretrial publicity that surrounded the case.,” the court said. “We reject Peterson’s claim that he received an unfair trial as to guilt and thus affirm his convictions for murder.”

RELATED: Sixteen Years Later, Family Of Scott Peterson Claims New Evidence Proves Innocence

But the justices said the trial judge “made a series of clear and significant errors in jury selection that, under long-standing United States Supreme Court precedent, undermined Peterson’s right to an impartial jury at the penalty phase.”

It agreed with his argument that potential jurors were improperly dismissed from the jury pool after saying they personally disagreed with the death penalty but would be willing to follow the law and impose it.

“While a court may dismiss a prospective juror as unqualified to sit on a capital case if the juror’s views on capital punishment would substantially impair his or her ability to follow the law, a juror may not be dismissed merely because he or she has expressed opposition to the death penalty as a general matter,” the justices said in a unanimous decision.

They rejected Peterson’s argument that he couldn’t get a fair trial because of the widespread publicity that followed, although the proceedings were moved nearly 90 miles (145 kilometers) away from his Central Valley home of Modesto to San Mateo County, south of San Francisco.

Stanislaus County District Attorney Birgit Fladager did not immediately say if she would again seek the death penalty.

Peterson, who is now 47, was convicted of first-degree murder in the death of his wife and the second-degree murder of their unborn son.

“We are grateful for the California Supreme Court’s unanimous recognition that if the state wishes to put someone to death, it must proceed to trial only with a fairly selected jury,” Cliff Gardner, Peterson’s appellate attorney, said in an email.

Get the app: Download the CBS Sacramento News app for iOS and Android

His well-known trial attorney, Mark Geragos, said he objected at the time to what he said was “clear error” in jury selection.

Geragos said he does not expect prosecutors to retry the penalty phase. “Frankly, I think the only reason that they sought the death penalty was to get a guilt-prone jury panel,” he said.

California has not executed anyone since 2006 because of legal challenges to the way it would carry out the death penalty, and Democratic Gov. Gavin Newsom has a moratorium on executions for as long as he is governor.

That moratorium helped lead other California prosecutors to negotiate a plea deal in the more recent high-profile Golden State Killer case. Former police officer Joseph DeAngelo was sentenced to multiple life terms on Friday in exchange for his guilty pleas to 13 murders and 13 rape-related charges.

After Peterson’s death, investigators chased nearly 10,000 tips and considered parolees and convicted sex offenders as possible suspects.

Scott Peterson was eventually arrested after Amber Frey, a massage therapist living in Fresno, told police that they had begun dating a month before his wife’s death, but that he had told her his wife was dead.

He also had contended on appeal that the trial court erred in deciding whether jurors and the defense were properly allowed to test whether Peterson’s new boat would likely have capsized if he dumped the weighted bodies over the side.

Peterson can still argue that he was unfairly convicted, using evidence that was not considered at his trial, and if that fails can try again in federal court.

“While we are disappointed that such a biased jury selection process results in a reversal of only the death sentence, we look forward to the Court’s review of the new forensic and eyewitness evidence of innocence,” Gardner wrote.

Geragos said he expects Peterson will eventually be exonerated. “We’re halfway there,” he said.

Copyright 2020 The Associated Press.