A 12-year-old boy tried to detonate a nail bomb at a Christmas market in Germany, authorities said.

The entrance of the Christmas Market in Ludwigshafen, Germany. Uwe Anspach / EPA

The explosive device was found near the Town Hall in Ludwigshafen earlier this month.

Hubert Stroeber, a spokesman for the local prosecutor's office, told NBC News that it would “turn down an investigation in the case” due to the fact the boy is aged under 14.

However, Stroeber confirmed that Germany’s Federal Prosecutor had been informed about the incident.

The suspect was born in Germany but is of Iraqi heritage.

Local officials said they had found a black bag in a waste container on Dec. 5, according to a police report.

Investigators said that the material found in the glass container was believed to be “pyrotechnical material that is used in fireworks.”

A map showing Ludwigshafen, Germany. Google Maps

Germany's FOCUS magazine reported that a controlled explosion was carried out after the device was spotted by a member of the public.

It added that the boy had tried to detonate explosives at the Ludwigshafen Christmas market on Nov. 26.

"A backpack included a glass container with a drilled hole, through which a wire was pulled. It was filled with explosive powder … and prepared with nails,” the magazine reported.

Related: Kids Will 'Torture and Kill' for ISIS, German Intel Chief Warns

It is not clear at this stage whether this was a separate device to the one found nine days later.

FOCUS quoted investigators as saying the “strongly radicalized” youth was likely “incited and instructed” by an “unidentified member of ISIS.”

He also had hoped to travel to Iraq to join ISIS last summer, it reported.

Due to the country's laws regarding the age of criminal responsibility, the 12-year-old was not arrested but instead reportedly taken into foster care.

German security officials confirmed to NBC News' partner ZDF that the details reported by FOCUS were correct.

Authorities also told ZDF that the boy had been radicalized via social media and the Internet.

Elmar Thevessen, ZDF’s deputy editor-in-chief and a terrorism expert, said: “Security officials are checking whether ISIS is targeting children and adolescents for potential terror attacks in Germany and Europe because they are least expected to commit violent acts.”

The incident follows warnings that teenagers are being turned into "weapons" by ISIS. The head of the Germany's domestic intelligence service told NBC News in May that children aged as young as 13 who had left for ISIS territory or who were "prepared to stage attacks" had been identified.

"When you know how ISIS treats children ... then you have to assume that you are dealing with people who are willing to unconditionally torture and kill for ISIS," said Hans-Georg Maassen, who is in charge of Germany's Office for the Protection of the Constitution (BfV).

Last month, the State Department warned U.S. citizens to exercise caution at holiday festivals, events and outdoor markets in Europe due to credible terrorist threats.