The U.S. Supreme Court in a ruling on Monday restored the conviction of a man found guilty of kidnapping and murdering 6-year-old Etan Patz, who went missing on his way to the school bus in SoHo in 1979.

The Supreme Court said a federal appeals court “exceeded its authority” in overturning Pedro Hernandez’s 2017 conviction.

The Second Circuit Court of Appeals decided last year that Hernandez should receive a new trial — and be released from prison in the meantime — because of a comment the judge made at Hernandez’s trial in response to a note from jurors. The jury ultimately convicted Hernandez of kidnapping and felony murder.

An earlier trial ended with a hung jury.

Hernandez’s defense attorney, Harvey Fishbein, said the defense team is “ terribly disappointed that Pedro will not have a new trial.”

He added, “We firmly believe that an innocent man is in jail for a crime he did not commit.”

Manhattan District Attorney Alvin Bragg said in a statement that the new ruling aligned with the findings of various other lower courts that have maintained the verdict at Hernandez’s second trial.

“This office has remained steadfast in its pursuit of justice for Etan and the Patz family and will continue to stand by this important conviction,” he said.

The ruling marks yet another twist in a case that has captivated the public for decades. Patz’s face appeared on milk cartons in hopes that a stranger might find him, and then-President Ronald Reagan proclaimed May 25, 1983 National Missing Children’s Day in his honor.

For years, Patz’s disappearance remained a mystery. But in 2012, Hernandez’s brother-in-law told law enforcement that Hernandez had made statements about his involvement. Hernandez worked at a bodega where Patz bought a drink on his way to the bus, and Hernandez allegedly told several people over the years that he had killed someone.

In May 2012, Hernandez told police that he strangled Patz and put his body in an alley, according to the Supreme Court ruling. He repeated the confession after police read him his Miranda Rights, in a separate interview with Manhattan prosecutors, and in conversations with psychiatrists.

Hernandez’s defense attorneys have argued these were false confessions from a man with severe mental illness and a low IQ. The Second Circuit found last year that his conviction should be tossed because the trial judge gave jurors improper instructions about how to evaluate the confessions.

In the 11-page ruling released Monday, the Supreme Court justices noted that last year’s decision “appears to reflect serious doubt about the reliability of Hernandez’s confessions.” But they said federal law “imposes strict limits” in cases like Hernandez’s.

The Supreme Court justices said the Second Circuit had overstepped by weighing in on an issue of state — rather than federal — law. The high court said the trial judge did not violate Hernandez’s federal rights, so the conviction should stand.

The ruling sent the case back to the lower courts for further proceedings. Justices Sonia Sotomayor, Elena Kagan and Ketanji Brown Jackson expressed their opposition, though the decision does not provide any explanation for their reasoning.

Hernandez is serving 25 years to life at Elmira Correctional Facility.

This story has been updated with additional information.