Hospital X-Ray technician and self-styled folk singer Tristan Morgan, 52, was spotted walking away carrying a petrol can and laughing as smoke spewed from the 18th Century synagogue in Exeter on July 21 last year.
Afterwards, CCTV was recovered showing Morgan being burned as he set light to the synagogue through a smashed window.
The defendant, from Exeter in Devon, admitted arson with intent to endanger life, encouraging terrorism by publishing a song entitled “White Man” to live-streaming website Soundcloud, and having a copy of the White Resistance Manual.
The court heard he was psychotic at the time of the arson attack but had no previous history of violence.
Judge Anthony Leonard QC handed Morgan a hospital order without limit of time, saying most people would feel “anger and revulsion” for what he did.
Outlining the facts, prosecutor Alistair Richardson said Morgan has “deep-rooted belief, embodied in a desire to do harm to the Jewish community and an obsession with abhorrent anti-Semitic material”.
Morgan made songs “exhorting others to violence” against the Jewish community and had an array of material which “revelled in the degenerate views of Nazi Germany and white supremacists”, Mr Richardson said.
On the evening of Saturday July 21 last year, he tried to burn down the synagogue “with no thought for any lives he might put at risk”, he said.
Mr Richardson told how Zoe Baker and her partner Samual O’Brien were walking through Exeter City Centre when they heard a “loud bang” and saw an “orange glow and smoke” coming from the grade two listed building.
Concerned that someone might be hurt, they stopped and Ms Baker saw the defendant walking from away carrying a green petrol can.
Mr Richardson said: “He appeared to be laughing, while trying to flatten his hair which she described as looking like it had been ‘whooshed up’.
Morgan appeared “cocky” as he drove off in a Mercedes Vito van, according to the eyewitness account.
Mr O’Brien and an employee of a nearby Mecca bingo tackled the blaze with fire extinguishers before the fire brigade arrived.
Firefighters found a “severe” fire in a room containing a gas boiler, which could have exploded.
Morgan’s van was identified on CCTV as well as footage of the defendant using a small axe to break a window of the synagogue.
The court was shown video of Morgan pouring liquid from his green petrol can through the window before he is engulfed in a ball of flames.
Police arrested him at his home in Alexander Terrace in Exeter.
As he opened the door to officers, the defendant, who smelt of petrol and burning, exclaimed: “That didn’t take long”.
He had burns to his hands, forehead and hair, the court heard.
In his pockets, he was carrying two lock knives and two lighters.
As he was put in a police van, Morgan said: “Please tell me that synagogue is burning to the ground, if not, it’s poor preparation.”
Later, as his burns were being treated in hospital, he told staff “it was like a bomb going off”.
The attack on the synagogue was described as “devastating” for the whole Jewish community.
The court heard the attack coincided with a Jewish feast day commemorating disasters, including the Holocaust.
The Exeter Synagogue, built in 1763, is the third oldest in Britain and remains a focal point for the Jewish community in the South West.
It underwent reconstruction in the 1990s and a £100,000 restoration project was completed in 2013.
The cost of repairing the fire damage was said to total more than £23,000.
The court heard how Morgan performed his song “White Man” under the alias of Arland Bran.
His song calling for “White Man” to “kill your enemy” was played 53 times, “liked” twice and shared once.