I bagged him alive, the mentally-ill accused murderer of iconic missing child Etan Patz claimed to cops, according to gruesome new confession details.

Pedro Hernandez — an 18-year-old, SoHo bodega clerk at the time Patz vanished nearby his store in 1979 — told cops he “placed the boy in a plastic bag [and] placed the bag in a cardboard box,” according to defense papers filed in Manhattan Supreme Court today, as Hernandez pleaded not guilty to kidnapping and murder.

“He then carried the box to the entranceway of a basement approximately one-and-a-half blocks away, where he placed the box on the ground just inside the open entranceway,” the defense papers continue in describing for the first time Hernandez’s confession, taped in May at the Camden County prosecutor’s office, near Hernandez’s current home in Mount Holly, New Jersey.

“According to the video-recorded statement by Mr. Hernandez, when he left the box, Etan Patz was still alive,” the papers say.

One law enforcement source, speaking on condition of anonymity, told the Post today that Hernandez specifically claimed Patz was breathing, but motionless.

“He said [Patz] was unconscious, but still breathing. He was almost dead,” said the source. “Hernandez said he panicked and dumped the body.”

It was some seven to eight hours after he was taken into custody that Hernandez, who has an IQ of approximately 70, made that first video-recorded statement to cops, his lawyer, Harvey Fishbein, told reporters after his client’s not guilty plea.

In his second videotaped statement, made the next day at the Manhattan DA’s office, Hernandez added that “Etan Patz might have died because of his actions,” say the defense papers, which seek the release of grand jury minutes and argue that in winning an indictment, prosecutors presented insufficient evidence.

The defense papers also confirm — as first reported in The Post — that the DA’s case against Hernandez consists entirely of these uncorroborated statements by a man suffering serious mental illness. Hernandez is bipolar and has suffered auditory and visual hallucinations, his lawyer has said in court.

Speaking to reporters after today’s not guilty plea, Hernandez’s lawyer said he will pursue a multi-pronged challenge to the prosecution, starting with questioning whether grand jurors had legally sufficient evidence to indict given that there is no forensic evidence establishing Patz has even been murdered.

“We have seen no evidence of death,” Fishbein said. “There is no crime scene here.”

The second prong, he said, will be to challenge Hernandez’s confession as false and the product of improper questioning.