A 16-year-old boy who constructed a shrapnel-filled device which could have been made into a viable CO2 bomb has been detained for five years.
Kieran Cleary told friends he was going to "go on a rampage" and "kill many people" weeks after making the potential weapon, prosecutors said.
A trial at Leeds Crown Court also heard that he warned fellow pupils around a year earlier that he was going to carry out a school shooting and that he praised Adolf Hitler, telling friends: "Gas the Jews."
A judge said Cleary told classmates: "I may as well bring a gun into school and do a school shooting."
The teenager, who had access to the Dark Web, had been extensively researching bomb-making tactics online, and nearly created a weapon with a potential 30-metre blast radius capable of being used "to cause maximum harm and death to civilians", prosecutors said.
His internet searches reflected a desire to seek out "extreme right-wing material and anti-Muslim material", the court was told.
Following a trial earlier this year, Cleary was convicted of making an explosive substance and three counts of possession of a document likely to be useful to a person committing or preparing an act of terrorism, but jurors cleared him of the more serious offence of making an explosive substance with intent. Sentencing him on Friday to five years in custody, Judge Geoffrey Marson QC said:
The boy, with a long fringe and wearing a T-shirt, showed no reaction as he was told the length of his sentence, which includes a four-year licence period.
During the trial, prosecutors said that, with the addition of gunpowder and a fuse, the device could have been a credible threat.
Paul Greaney QC, prosecuting, said the defendant became interested in far-right ideology, using the internet to access videos and information about murder, torture and mutilation.
He first came to the attention of police aged 13 and was referred to Prevent, the Government's counter-terrorism strategy, in 2017, the court heard.
In July 2018, Prevent received information that the boy had told fellow pupils he was going to go on a rampage, aiming to kill many people and then be shot by the police or kill himself, and this led to a search of his home in Bradford, where items were found including two carbon dioxide canisters joined together and an assortment of nails, tacks and panel pins.
One of the canisters had been filled with nails.
The court heard that he searched for and watched videos about the English Defence League, attacks on Muslims, the Columbine High School massacre, and murder and mutilation.
The judge said:
Psychological examination has shown the boy's personality traits reflect a potential risk to himself and to others, a lack of empathy, manipulation of others and an obsession with weapons, Mr Greaney said. Even after being detained, the boy accessed the internet to make "far-right protestations" using the username White Terrorist, the court heard.
Giving evidence in his defence during the trial, the boy said he made extreme comments because he was showing off and "being stupid", and that he had only built the device to show off to his friends.
Ali Naseem Bajwa QC, defending, said the jury's verdict reflected the lack of "malevolent intent with regard to the explosive device", which he said was stored in open sight in the teenager's bedroom in Camberley Mount, Bradford.