An Edinburgh man who armed himself with a high-powered crossbow and a foot-long machete has been jailed for 10 years.
Gabrielle Friel, 22, was found guilty of offences under the Terrorism Act.
He admitted being obsessed with mass killings such as the Columbine High School massacre but denied that he was planning to carry out such an attack.
Friel was convicted of possessing the weapons in circumstances giving rise to the reasonable suspicion they were for "a purpose connected with terrorism".
Passing sentence at the High Court in Edinburgh, Lord Beckett told him: "There is no suitable alternative to a custodial sentence. It is necessary to punish you, to seek to deter you and others from acquiring articles for the purposes of terrorism."
The judge said there was no justification in Friel's background for what he had done.
Friel was accused of having the weapons and a bulletproof vest at various locations including his home, a community justice social work centre and the Royal Edinburgh Hospital between 1 June and 16 August 2019.
He denied the charge, but a jury found him guilty by majority verdict.
A separate charge that he was motivated by incel (involuntary celibate) ideology was found not proven.
The ex-college student was told that for 30 years he would be subject to notification requirements under counter terrorism legislation, which will inform the authorities of his whereabouts.
The judge also made a serious crime prevention order to run for five years after his release, controlling use of mobile phones and the internet.
In 2017 Friel wounded a police officer with a knife at Edinburgh College. He spent six months in a psychiatric hospital and was later ordered to carry out 300 hours of community service for the offence.
He was arrested in 2019 after a social worker and forensic psychiatrist raised concerns about his behaviour. The weapons were found at his home in Edinburgh along with a telescopic sight, steel tipped crossbow arrows and an incomplete ballistics vest.
During the trial forensic psychiatrist Dr Alexander Quinn said Friel had said he felt "an affiliation" with Californian mass murderer Elliot Rodger.
Rodgers, who killed six people in a stabbing and shooting spree in Isla Vista, California, in May 2014, became a key figure in the incel (involuntary celibate) movement.
Friel told the jury that mass shooting was a "fantasy" for him and that he had empathy for Rodger.
But he said he was not an incel and described killers as evil.
He said he bought the weapons in summer 2019 as he wanted to provoke police to shoot him.
Defence solicitor advocate Brian Gilfedder said: "What we are dealing with here is a disturbed young man haunted by thoughts of violence to the extent that he wants to die and he does not want to be here."
He said it was accepted that in August 2019 he had been "a clear and present threat to the safety and well-being of the public at large".