A teenage racist firebombed an Asian-owned takeaway shop in Fife then bragged about it online.
Charles Johnston wore a mask and waved a machete as he ranted about Muslims and claimed he had burned down a kebab shop.
However, his mask proved pointless when he blurted out his home address after being challenged.
Johnston was also wearing the same hoodie he had on when he tried to burn down the takeaway in Rosyth.
The incident had been captured on CCTV and he was quickly arrested. He said he believed money being taken for kebabs was going towards terrorism.
At Dunfermline Sheriff Court, Johnston, 19, of Tovey Road, Rosyth, admitted setting fire to Shalimar Kebab on Queensferry Road by lighting a bottle of petrol and throwing it at the shop.
His crime, on May 18, was aggravated by religious prejudice.
On June 2 he uploaded a live video to online broadcasting service Periscope, in which he repeatedly made racist, offensive and abusive remarks, all while holding a machete with his face masked.
He further admitted that on the same day, at Sherbrooke Road, he was in possession of a lock-knife.
Depute fiscal Alex Kirk told the court Johnston had gone to the takeaway on his bike after midnight when it was closed and shuttered.
He had his hoodie pulled on, was carrying a bottle full of petrol and had just bought a lighter from a local garage.
His actions were then caught on CCTV.
Mr Kirk said: “The accused then stops his bike directly outside of the locus, gets off the bike and walks with the bike out of sight. He is still holding the bottle.
“At 12.17pm the accused approaches the locus on foot. He is holding a mobile phone in one hand and the bottle in the other.
“As he is standing outside, a flash and glow becomes visible before the accused throws an object directly at the locus.
“The metal shutters are already down, the object results in a fireball and burns for a period of time.
“The accused is observed holding out his mobile phone as though recording this. He then runs away, retrieving his bike and cycling away.”
A taxi driver saw the fire and someone on a bike filming it on their phone.
Around a fortnight later, Johnston was bragging on the internet.
As he ranted, he said: “I set the kebab shop on fire… I spat on the mosque.
“I set a kebab shop on fire because halal food contributes a 2% tax. Every kebab bought contributes to terrorist organisations.”
Defence solicitor Elaine Buist said, “He says he doesn’t have anything against individual Muslims.”
Sheriff Charles MacNair responded, “That is what is said by just about every racist. He clearly is a racist.”
Ms Buist went on, “He’s been looking at propaganda on the internet and taken that as fact.”
Of the firebomb attack, she said, “He’s at a loss to explain what happened. He has little recollection of that incident.
“He has no previous convictions and is deeply embarrassed by the charges.”
Sheriff MacNair called for reports and allowed bail. Johnston will be sentenced on April 17 and was warned a custodial term is likely.