A 16-year-old Northamptonshire boy who fantasised about carrying out an attack on a school has pleaded guilty to three charges at a hearing at Birmingham Magistrates' Court.
The teenager, who cannot be named for legal reasons, admitted having 20 manuals, including a book on how to make Semtex, contrary to the anti-terrorism laws, and possessing two of the three chemicals needed to make a simple explosive, in breach of the Explosives Act.
District Judge Howard Riddle was told that the youth was diagnosed with Asperger's syndrome shortly after his arrest in February 2011. The behavioural condition caused him to become fixated on certain topics, according to consultant child psychologist Dr John Brian.
He was later sectioned under the Mental Health Act and has been receiving treatment for his condition.
The teenager came to the attention of British police when agents from the US Federal Bureau of Investigation passed on an alert to Metropolitan Police. They received the alert from a web user in the US regarding comments made by the boy on an online chatroom about a school massacre, said prosecutor John Topping.
In a chat room, the boy said: "20 minutes from now I am going to storm a high school armed with a Magnum (handgun) and a Beretta (pistol) ... and shoot until the police arrive and then shoot himself".
The teenager also posted several pictures of himself on a website posing with imitation guns, one of which made reference to a high school.
The boy kept a book written with his own "notes about plans to kill pupils at school", including a plan of where people sat at their desks and who should be shot, said Mr Topping.
Research was found on the boy's bedroom computer in Northamptonshire, which uncovered an interest in serial killers and guns.
Dr John Brian said the boy was diagnosed with Asperger's in February last year which, untreated, could lead to anxiety and a fixation with particular topics.
Asked by Mr Topping if he thinks the boy is a risk to the public, Dr Brian said the risk assessment carried out when the teenager was first seen by doctors shows that "he was a risk, yes".
The boy told Dr John Brian that "none of it would have happened" and expressed regret at what he had done.
Dr Brian said the boy "told me he thinks it was the biggest mistake of his life" and is "getting better as time has gone on".
The teenager admitted possessing explosive substances sulphur powder and potassium nitrate between January 1 and February 26 last year, and owning manuals of a kind likely to be useful to a person committing or preparing an act of terrorism.
The boy also admitted possessing prohibited images of children.
Sentencing, Mr Riddle handed the boy a hospital order under section 37 of the Mental Health Act, which will run for six months but can be extended.