A court in Nagoya imposed a sentence of three to five years on a former university student on Monday for making an explosive often used in the powerful bombs detonated in terror attacks, as well as stimulant drugs and a 3D-printed gun.

The 19-year-old male, whose name has been withheld because he is a minor, produced triacetone triperoxide, known as TATP, at his home in Nagoya in December 2016 and burned the substance in a park in March 2018, according to the indictment.

He also made a 3D-printed gun around September 2017 and stimulant drugs in August 2018 in conspiracy with an 18-year-old male from Ibaraki Prefecture.

The Nagoya District Court handed down what is known as an indeterminate sentence, determining only the minimum and maximum detention period. Such sentences are given only to minors in Japan under the Juvenile Law, and take an accused person's age and behavior in prison into account.

"He took the possibility of an accidental explosion lightly," prosecutors, who demanded a jail term of three to six years, had said earlier. "There is the risk of copycat offenders using information easily obtained on the internet."

His defense team demanded he be placed under protective custody in a juvenile correction facility.

"The explosive substance was ignited, but there were no victims," his lawyer said, adding that the gun was made for ornamental purposes and that the stimulants were not of sufficient quality to make them sellable.

Police located and arrested the teenager in August 2018 after he was spotted on security camera footage following the explosion in the park.

He was initially sent by prosecutors to the Nagoya Family Court as a minor, but his case was sent back to prosecutors in November 2018 after it was concluded he should face criminal charges in light of the seriousness of the case.