It took 38 years and two trials, but a Manhattan jury on Tuesday brought the mystery of little Etan Patz’s 1979 disappearance to a close — convicting a former grocery clerk of killing the 6-year-old boy whose face would come to influence American parenting and law enforcement.

Patz’s father, Stan, hugged jurors and declared that the verdict — finding 56-year-old Pedro Hernandez guilty of kidnapping and second-degree murder — was something his boy deserved after all these decades.

“The Patz family has waited a long time, but we’ve finally found some measure of justice for our wonderful little boy, Etan,” said the dad, who had to suffer through Hernandez’s first trial in 2015 ending in a hung jury.

“I am truly relieved, and I’ll tell you, it’s about time. It’s about time,” he said, choking back tears.

Stan and Julie Patz still reside in the same Prince Street apartment in Soho that Etan left on May 25, 1979 — the last time they would see their young son.

Julie, who attended much of the first trial, wasn’t in court when the verdict was read, but Stan added: “I talked to her on the phone. She was crying.

“I’m really grateful that this jury finally came back with which I have known for a long time — that this man, Pedro Hernandez, is guilty of doing something really terrible so many years ago.”

Manhattan DA Cyrus Vance Jr. hailed the verdict and said the jury “affirmed beyond all lasting doubt that Pedro Hernandez kidnapped and killed the missing child” in “one of the city’s most famous and formative cases.”

It was a long time coming.

Etan’s disappearance, on the first day his mom and dad let him go to school on his own, terrified parents across the country. He became one of the first missing children ever pictured on milk cartons, and the anniversary of his disappearance has been designated National Missing Children’s Day.

Stan and Julie Patz lent their voices to a campaign to make missing children a national cause, and it fueled laws that established a national hot line and made it easier for law enforcement agencies to share information about missing youngsters.

The case took investigators as far as Israel, but Hernandez wasn’t a suspect until renewed news coverage prompted a brother-in-law to tell police in 2012 that Hernandez had revealed to a prayer group decades earlier that he’d killed a child in New York. Authorities would later learn that he’d made similar, if not entirely consistent, remarks to his ex-wife and a friend in the early years after Etan vanished.

Police went to Hernandez’s home in Maple Shade, N.J., where they interrogated him for 6¹/₂ hours. The former stock clerk confessed on videotape to luring the child into the basement of the bodega near Etan’s bus stop with the promise of a soda and strangling him until he went limp.

“Something just took over me,” Hernandez said in one of a series of recorded confessions to police and prosecutors. He said he’d wanted to tell someone, “but I didn’t know how to do it. I felt so sorry.”

Etan’s body was never found.

Hernandez claimed he put Etan’s body in a box with the trash and the little boy was never seen again.

Hernandez’s lawyers claimed he’s mentally ill and can’t be taken seriously. That argument prompted one holdout juror to refuse to convict him in 2015.

But this time, jurors said Hernandez’s confession to cops and other incriminating statements to members of his church sealed his fate.

“The church confessions, obviously, we thought those were very reliable, those were corroborated by a number of people including Pedro Hernandez. He never denied that he confessed to a number of the church people,” juror Mike Castellon said.

“It was shortly after the crime. He wanted to repent and to receive forgiveness which he did.”

Defense lawyer Harvey Fishbein said he’ll appeal. The defense had tried to pin Etan’s disappearance on a convicted child molester now doing time in Pennsylvania, whom the Patz’s had earlier believed was their child’s killer.

Castellon, a construction company attorney, agreed Hernandez might be mentally disturbed but still believed in his guilt.

“We decided he has an illness — but that didn’t make him delusional,” the juror said. “We think he could tell right from wrong. He could tell fantasy from reality.”

As much as Etan’s disappearance captivated and terrified New Yorkers in the 1970s and 1980s, jurors in Hernandez’s case said they knew little of it coming into jury duty.

Nine of the 12 jurors met with reporters on Tuesday and eight of them said they had never heard of Etan Patz beforehand.

Only one said he had read a short newspaper story on the case before landing on this trial.

Stan Patz said he was prepared for bad news after the earlier hung jury. And he profusely thanked Assistant DA Joan Illuzzi and investigators for securing the guilty verdict.

“I needed to know what happened to my son,” he said.

Four jurors from the first trial who voted for conviction came to court in hopes of finally witnessing justice for Etan.

First-trial jurors Jennifer O’Connor and Cindi Cueto held hands with Stan Patz as the verdicts were read.

“We were desperate for it to go the right way. There was a lot of squeezing, tears and relief,” O’Connor said. “We’re very grateful for the closure they’re giving to the Patz family.”

Cueto followed the second trial and said prosecutors were more concise this time.

“They were able to show a better story this time,” she said. “They [the second jury] seemed to be just a lot more logical.”

Adam Sirois, the holdout juror from the first trial, had attended parts of the re-trial, but was not seen in court Tuesday. He could not be reached for comment.

Additional reporting by David K. Li, Post Wires