A Minnesota man confessed Tuesday to abducting and killing 11-year-old Jacob Wetterling nearly 27 years ago, recounting a crime that long haunted the state in chilling detail that included a handcuffed Jacob asking him: "What did I do wrong?"

Danny Heinrich, 53, of Annandale, made the admission as he pleaded guilty to a federal child pornography charge that will likely keep him locked up for 20 years, with civil commitment possible after that, meaning he could spend the rest of his life in custody.

Asked whether he abducted, sexually assaulted and murdered Jacob, Heinrich said: "Yes, I did."

As part of the plea agreement, Heinrich will not face state murder charges in Jacob's death. U.S. Attorney Andy Luger said it was the only way to get Heinrich, whom he described as a volatile man, to show authorities where they could find the boy's remains.

"He's not getting away with anything. We got the truth. The Wetterling family will bring him home," Luger said.

Prosecutors said the family was consulted on and approved the plea agreement, which required Heinrich to give a detailed confession and tell investigators where to find Jacob.

In the years after Jacob's disappearance, his mother, Patty, became a nationally known advocate for missing children. A 1994 federal law named for Jacob requires states to establish sex offender registries.

With Patty and Jacob's father, Jerry Wetterling, in a packed courtroom, Heinrich described seeing Jacob, Jacob's brother, and a friend bicycling down a rural road near Jacob's central Minnesota home in St. Joseph the night of Oct. 22, 1989.

Heinrich laid in wait for the three boys to return, and when they did, he put on a mask and confronted them with a revolver. He said he ordered them into a ditch and asked their names and ages.

Heinrich said he told the two other boys to run and not look back or he'd shoot. He said he then handcuffed Jacob and drove him to a gravel pit near Paynesville, where he molested him. Afterward, Jacob said he was cold, and Heinrich let him get dressed. Jacob then asked whether he was taking him home.

"I said, 'I can't take you all the way home,'" Heinrich said. "He started to cry. I said, 'Don't cry.'"

Heinrich said at some point a patrol car with siren and lights passing nearby caused him to panic. He said he pulled out his revolver, which had not been loaded, and put two rounds in the gun. He said he told Jacob to turn around. He held the gun to the boy's head and pulled the trigger. The gun didn't fire. Heinrich then fired two shots. After the second, Jacob fell to the ground.

Some of Jacob's family members cried openly as Heinrich calmly described the crime.

Heinrich said he went home for a couple of hours, then went back to the gravel pit and buried Jacob about 100 yards away. He said he returned to the site about a year later and saw that Jacob's jacket and some bones had become exposed.

"I gathered up as much as I could and put it in the bag and transported it across the highway" to a field, and reburied the remains, he said.

Heinrich led authorities to Jacob's buried remains in a central Minnesota field last week. The remains were identified Saturday.

"It's incredibly painful to know his last days, last hours, last minutes," Patty Wetterling said after the guilty plea. "To us, Jacob was alive, until we found him."

Heinrich's attorneys declined to comment after the hearing.

Authorities named Heinrich as a person of interest in Jacob's disappearance last October when they announced the child pornography charges.

Heinrich had long been under investigators' scrutiny. They first questioned him shortly after Jacob's abduction, but he maintained his innocence and they never had enough evidence to charge him. They turned a renewed spotlight on him as part of a fresh look into Jacob's abduction around its 25th anniversary.

As part of that effort, investigators took another look at the sexual assault of 12-year-old Jared Scheierl, of Cold Spring, nine months before Jacob's disappearance. Investigators had long suspected the two cases were connected.

Using technology that wasn't available in 1989, investigators found Heinrich's DNA on Scheierl's sweatshirt, and used that evidence to get a search warrant for Heinrich's home, where they found a large collection of child pornography. The statute of limitations had expired for charging him in the assault on Scheierl, but a grand jury indicted him on 25 child pornography counts.

As part of Tuesday's plea deal, Heinrich also admitted to assaulting Scheierl.

The AP typically doesn't identify victims of sexual assault, but Scheierl has spoken publicly for years about his case, saying it helped him cope with the trauma and that he hoped it could help investigators find his attacker and Jacob's kidnapper.

Jacob's abduction shattered childhood innocence for many rural Minnesotans, changing the way parents let their kids roam. His smiling face was burned into Minnesota's psyche, appearing on countless posters and billboards over the years.

Heinrich is scheduled to be sentenced on Nov. 21.