Federal German prosecutors are investigating a 12-year-old boy who allegedly attempted to set off a nail bomb in the southern city of Ludwigshafen.

Interior Ministry spokesman Tobias Plate confirmed to reporters that the federal prosecutors' office was investigating the case, but referred further questions to prosecutors.

Prosecutors did not immediately return calls, but spokesman Stefan Biehl confirmed to the Sueddeutsche Zeitung newspaper that his office was investigating.

Focus magazine first reported the case, citing unidentified sources, saying the boy was born in Germany to Iraqi parents, who consented to having him taken into youth detention.

Focus reported that the device found on December 5 was a glass jar packed with nails and material from firecrackers.

Police said it would have burned, but not exploded.

Stephan Meyer, parliamentary spokesman on security issues for Chancellor Angela Merkel's conservative bloc, confirmed the details of the report.

Ms Merkel's spokesman, Steffen Seibert, would not comment on details of the case but said it was a "startling case to everyone, and I think the proper response is to investigate it thoroughly".

The boy apparently had turned rapidly to Islamic extremism.

"This shows how quickly the radicalisation of a young person, a child, can take place," Mr Meyer said.

Sign up to our free newsletters

Get the best updates straight to your inbox:
Please select at least one mailing list.

You can unsubscribe at any time by clicking the link in the footer of our emails. We use Mailchimp as our marketing platform. By subscribing, you acknowledge that your information will be transferred to Mailchimp for processing.