A man on trial for terrorism offences discussed livestreaming “an incident” and said he wanted First Minister Nicola Sturgeon “to die” in an online pro-fascist forum, a court has heard.

Sam Imrie has been charged with posting statements on social media platform Telegram suggesting he was going to carry out an attack on the Fife Islamic Centre in Glenrothes, Fife.

The 24-year-old has also been accused of planning to stream live footage of “an incident”.

Giving evidence at the High Court in Edinburgh on Tuesday, Detective Constable Jonathan Leitch, who works in counter-terrorism, discussed messages allegedly posted by the accused in a Telegram channel called “Fashwaveartists”.

In a series of posts in July 2019, Imrie allegedly wrote: “I just want them all dead. I just want my people to live free.

“I don’t give a f*** who I have to kill to make it happen. I will meet them at the door with closed fists, ready to fight.

“I’m tired of being nice, I want to atom bomb all of the Middle East and all of Africa. F*** all you n******.

“I want to stream it but I also don’t want to get caught. I think I will stream it though. We are going to kill the invaders.”

Imrie also allegedly hit out at the SNP over its immigration policies.

“The SNP Party wants millions of Muslims to come in so obviously I want Sturgeon to die,” he allegedly wrote.

The court heard that on July 4 2019, the accused posted a series of images and videos of the Fife Islamic Centre, a green petrol can and a fire at a building in the online group.

He allegedly began the posts with the words: “Sorry we can’t be friends, it’s time to rise.”

Imrie had previously been accused by other in the group of being a “fed” or “cop”, and was warned not to discuss his plans on the app.

At 4.15pm he posted two photos, one of a green petrol can in the passenger seat of a car, another of the Fife Islamic Centre, the court heard.

On seeing the images, DC Leitch told the court: “I would assess that to be the Fife Islamic Centre.”

Imrie’s posts continued: “Animals have their windows barred like a zoo. I’m heading to location 2. Updates in 15 mins (sic) or so.”

He followed this by saying: “We will kill all n******”.

In total the accused posted five videos of the centre, the last appearing to show a fire being started outside the building.

Imrie posted: “Just smashed a car recording this, nearly there. Too late to go back, we will kill them all.”

Other posts allegedly made by the accused at that time said: “Filthy c**** get out of my homeland”; “The trees and bushes should keep it burning, I’m driving home”; and “We will kill every s***skin”.

When another user asked what the video was showing, the court heard that he replied: “That’s the Islamic centre next to the woods, retard. I’m going to jail.”

The accused was earlier warned by other users not to discuss the issue in the group.

He responded: “There is no going back. Any chance I actually get away with it?”

Other users appeared to try to dissuade him.

One said: “Throwing you life away doesn’t make you a martyr, especially when you throw it away on a whim.

“Targeting innocents at this stage will only harm the rest of us.”

Imrie is said to have replied: “No invader is innocent.

“F*** it, why wait? Hypothetically if I was going to livestream something cool, where should I do it?”

The court was later shown CCTV footage taken from the Islamic centre, on the same day as Imrie posted the videos to the Telegram app.

The CCTV images were then juxtaposed with the Telegram videos.

In the footage, a blue ford Fiesta with the registration plate NK53 FPG can be seen, with a green petrol can in the passenger seat.

A male can also be seen, described by Leitch as wearing grey trainers, dark trousers, a navy blue hoodie with a T-shirt underneath, and a dark baseball cap. He can be seen walking along the building with a phone.

DC Leitch told the court the CCTV footage appears to correspond with the videos uploaded to Telegram.

Cross-examining, defence solicitor advocate Jim Keegan QC told the court that what was happening in the footage was “a ruse”.

“He was kidding on that he was going to commit a crime on Telegram, that’s what was going on,” he said.

DC Leitch responded: “That’s your interpretation.”

Mr Keegan continued: “If he wanted to set the place on fire, he could have poured petrol on the door and set it on fire. Does he do anything with the can?”

DC Leitch agreed that he did not.

The defence said the location of the fire seen in the Telegram footage is a nearby abandoned building.

He said Imrie was creating the impression to users in the Telegram group that the fire was being started at a mosque or Islamic centre, but this was not the case.

“This was just a con, carried out on Telegram, to kid these people that he was some sort of Nazi fire-raiser,” Mr Keegan said.

He noted that those in the Telegram group did not appear to support the accused’s actions.

DC Leitch said: “They thought he was someone who was trying to get them into trouble.”

Among other charges, Imrie is accused of being in possession of neo-Nazi, anti-Semitic and anti-Muslim material, extreme pornography, including indecent images of children, and an image involving a human corpse.

He is also charged with driving while under the influence of drugs and alcohol in July 2019.

He denies all of the nine charges against him, three of which come under the Terrorism Act.

The trial, before Lord Mulholland, continues.