A teenager accused of planning a massacre at a Minnesota school last year pleaded guilty Friday to one count of possessing an explosive device.

John LaDue, 18, entered his plea in Waseca County District Court. As part of the agreement, five similar counts will be dismissed. LaDue will face no prison time and will instead be sent to a secure treatment facility for autism spectrum disorder patients. After that, he'll go to a halfway house and then to intense supervision before he's released on probation for five to 10 years.

"It is our belief that this plea offer is the best outcome possible, under the circumstances, to ensure public safety," Waseca County Attorney Brenda Miller said in a statement.

LaDue, who is scheduled to be sentenced Oct. 19, was 17 when authorities say he plotted an attack at Waseca Junior-Senior High School.

In April 2014, a witness called police after she saw LaDue enter a storage locker. Police found him with bomb-making materials, and he told authorities that he planned to shoot his family then go to the school, kill the school's police liaison officer, then kill as many of his fellow students as possible by setting off bombs and shooting them in the ensuring confusion.

He directed police to an extensive handwritten journal detailing his plans and admitted setting off incendiary devices around Waseca.

He was initially charged as a juvenile with four counts of attempted murder, two counts of first-degree damage to property and the six felony counts of possessing a bomb. The attempted murder and property damage counts were dismissed earlier, after a judge found that the state failed to show LaDue made a substantial step toward committing the crimes.

Last month, a different judge certified LaDue to stand trial on the bomb possession charges as an adult, citing the seriousness of the allegations. Waseca County District Judge Robert Birnbaum wrote that public safety would not be served by trying LaDue in the juvenile system and that he needed more time for treatment, rehabilitation and monitoring.

Friday's plea came during a hearing at which LaDue's attorneys were planning to argue that all six explosive possession charges be dismissed.

LaDue's attorney, Steve Bergeson, told reporters after the hearing that the length of LaDue's term will be based on his progress through a program and evaluations by therapists.

LaDue's father, David, said: "10 years' probation sounds like a life sentence to me. ... John spoke the truth since the police talked to him. I hope the people treating him would be open and forthright in the decisions they make about his treatment."