A violent and mentally unstable Muslim convert has been jailed for five years and four months for having a stash of bomb-making manuals and instructions on how to carry out "lone wolf" knife attacks.
Lee Griffiths was branded a "dangerous" man after he was caught hoarding terrorist material, including copies of Islamic State magazine Rumiyah and the Anarchist Cookbook.
The ginger-bearded 26-year-old also had graphic videos showing prisoners being stabbed to death or blown up with a home-made explosive device.
Griffiths, from Western Road, Clydach, Swansea, admitted five counts of possessing information which may be useful to someone who commits or prepares acts of terrorism and one of dissemination of a terrorist publication.
The Old Bailey heard Griffiths had been handed a hospital order in 2011 after he launched a knife attack on his mother while she slept and had twice been stopped by police for carrying blades in public.
Following his discharge in August last year and while living at The Beeches residential home for mental health service users, Griffiths was quickly radicalised, the court heard.
The extremist material was uncovered after police raided his bedroom and seized his mobile phone in January this year.
Even though Griffiths was not charged with planning a terror attack, a senior judge said he could not rule out the threat he could have posed in the future.
Sentencing, Mr Justice Saunders said: "I am not of course sentencing this defendant for preparation of terrorist acts himself at the time of his arrest. That would have been a different charge.
"It cannot, however in my judgment be ruled out that at some stage, because of his mental instability, the defendant could have made use of the information himself or have supplied it to another to enable them to carry out a terrorist outrage.
"Whatever the nature of the defendant's mental problem, I accept that he is vulnerable but he is also dangerous. He has shown that he can be extremely violent for no reason and his radicalisation and beliefs cause considerable concern.
"If it was open to me to pass an extended sentence then I would, because of the danger the defendant presents. It is not."
The judge said Griffiths had become radicalised while at The Beeches but it was impossible to say whether it was "as a result of the interventions of others or simply from what he found on the internet".
Mr Justice Saunders made a recommendation that on Griffiths' release, conditions of residence be attached to keep a "close eye" on his activities and, if possible, to monitor his access to the internet.
Earlier, prosecutor Simon Davis said the defendant had been sent to a medium secure mental health unit in Bridgend after he attacked his mother.
He was released from the Carswell clinic in August 2016 on condition that he live at the residential home in Swansea where he was routinely searched by staff when he went out.
Mr Davis said staff had noticed he changed from being interested in fishing, cooking and football to becoming fixated with Islam, serial killers and playing the violent video game Battlefield.
His views became ever more extreme by October last year when he also attended a mosque in Swansea.
The defendant, who worked at a local food bank, was described as vulnerable and easily led but computer savvy.
Following his arrest in January, Griffiths issued a "bare denial" then refused to comment further in police interview.
Ian Ibrahim, for Griffiths, said it was difficult to mitigate in the wake of recent atrocities but stressed the defendant was a "young man with a history of psychiatric illness".
The barrister said his client never intended to carry out any acts of terrorism and was not a member of a banned group.