A teenager accused of preparing acts of terrorism was a member of a "secretive neo-Nazi" group who branded MP Jo Cox's killer a "hero", a court has heard.
The 17-year-old from Bradford, who cannot be named because of his age, denies the charge and another count of making a pipe bomb.
Prosecutors said on the day Mrs Cox died he posted a picture of her killer online saying "Thomas Mair is a HERO".
Jurors heard he was arrested after he put a photo of a homemade bomb online.
Mrs Cox was murdered by Mair on 16 June in Birstall, West Yorkshire, just days before the EU referendum in which she had campaigned to remain in the EU.
Barnaby Jameson, prosecuting, said the boy was a part of neo-Nazi youth group National Action and on the day of the killing he had made a number of comments on social media.
In one he wrote: "We need more people like him to butcher the race traitors."
Mr Jameson said: "[His] political views were so extreme that he celebrated in the murder of a democratically elected MP - presumably because she had voted to remain in the EU.
"In [his] view this was race treachery."
The jury was also shown footage of the boy at a National Action demonstration in York.
Mr Jameson described the organisation as "white supremacist" and known to be "anti-Muslim, anti-black, anti-semitic and anti-gay".
Messages were discovered on the boy's phone from members of a National Action chat group that included phrases such as "should we just blow up Leeds?", the court heard.
The jury was told he was arrested by counter-terrorism police after a member of the public reported a series of Snapchat messages sent by the defendant, including an image of a "viable" homemade pipe bomb.
The device was later found in a drawer at the boy's home, prosecutors said.
'All out race war'
In one message the boy was said to have written "Incendiary explosive and home-made black powder. More to come" over a photo of the device, and an emoji of a figure in a turban with a gun pointing to his head and an image of Bradford.
Mr Jameson said had the bomb been exploded it "could have the capacity to cause shock and injury and damage to property in the immediate vicinity".
The jury heard the defendant accepted making the device and sending the Snapchat messages, but said it was a "bad joke gone wrong" and that he did not intend to carry out a terrorist act.
Mr Jameson said: "In this case there is no evidence of a specific terrorist attack - nor does the Crown need to prove one.
"This is a case that relates to terrorism generally."
He said the alleged activity was the "opening stage" in the defendant's "all out race war and that is why the Crown leads its case with an allegation under the terrorism legislation."
The trial at Leeds Crown Court continues.