A teenager who made a pipe bomb which was found in his Nazi memorabilia filled bedroom has avoided a prison sentence.

The 17-year-old was found guilty last month by a jury at Leeds Crown Court of constructing the explosive device but not guilty of a terrorism offence.

On Monday, a judge said that as the teenager had already served the equivalent of a 14-month-long sentence on remand, he was giving him a Youth Rehabilitation Order with various stipulations, including a ban from using the internet.

A week-long trial heard how the pipe bomb was found in a desk drawer in his Bradford bedroom after police were alerted through suspicious Snapchat messages.

Prosecutors said one of these messages was a cartoon-like image of a mosque being blown up along with the words: "It's time to enact retribution upon the Muslim filth."

Another was a picture of a pipe bomb with an image of the Bradford skyline and the message: "Incendiary explosive and home-made black powder. More to come."

The jury heard how officers found the defendant's bedroom covered in flags, including the swastika and the symbol of the Waffen SS as well as a laptop with wallpaper featuring a Nazi eagle over a swastika and the German phrase: "One Nation, One Empire, One Leader."

But the teenager told the court he never intended to use the pipe bomb.

The judge, Mr Justice Goss, reminded the court that the defendant's "perverted" views led to him celebrating the murder of Labour MP Jo Cox and proclaiming her murderer, Thomas Mair, as a hero.

He explained how the explosive device found at the teenager's Bradford home on July 26 last year contained 19 grammes of explosive material the teenager had gathered from sparklers.

He said the device had the potential to harm "flesh and bone" if it went off when it was held and also cause a fire.

The judge said: "It was not made for any lawful purpose. Precisely what your intention in relation to is was is much more complex."

But he said he rejected the defendant's claim that he was just "fooling around" with it and had forgotten about it when the police arrived.

The judge also said: "You are quite unable to articulate why you are now sorry and you continue to express very extreme views."

The court heard how the teenager had a previous conviction for arson from when he exploded aerosol cans when he was 12, setting light to a hedge.

The judge noted how the defendant had embarked on a journey of reading which took him from Trotskyism to Stalinism to anarchism and back to Stalinism before he found National Socialism at the beginning of 2016.

It was after this that the teenager became associated with National Action, which is now a proscribed terror group and was described in court as "a small, secretive neo-Nazi British youth nationalist organisation".

The defendant said in the witness box that he only posted a picture of the pipe bomb to see if he could get a reaction and then put it back in his drawer.

He said he did not plan to attack anybody.

The judge said the Youth Rehabilitation Order would last for three years and would involve him being supervised, attending a preventative intervention programme for a year, staying off the internet and not contacting any proscribed groups.