A Muslim convert prisoner from Wolverhampton who wrote of plans to bomb a Territorial Army base from his cell has been ordered to be detained indefinitely.
Paranoid schizophrenic Kevin Gardner, 23, wanted to attack the Chesterfield centre where he was formerly a cadet.
Gardner also made detailed notes and drawings of chemical formulas to make a home-made chlorine bomb and other explosives, Manchester Crown Court heard.
The defendant also wrote of targeting troops as they returned to UK bases following service in Afghanistan. His activities were uncovered in numerous cell searches between April 2006 and January 2007 during his stays of detention at Stoke Heath Young Offenders' Institute and HMP Featherstone.
The court was told he gathered his information from textbooks in the prison libraries and appeared to have converted to his new faith through watching television while in custody.
The material was confiscated by the authorities but he was not questioned by police over the matter until he was arrested on release from Featherstone in February 2007.
Gardner claimed his sole intention was to disrupt prison staff who he believed had launched a whispering campaign against him.
Sentencing Gardner to an hospital order without time limit, Judge Clement Goldstone QC said the defendant was a "sick man" but "potentially dangerous" because of his illness.
Gardner pleaded guilty at an earlier hearing to collecting information likely to be useful to a terrorist. He also faced one count of preparing for acts of terrorism, which was ordered to lie on file.