A man who attempted to set fire to the Scottish Parliament, causing a "major security alert", has been jailed for 30 months.

Piotr Swiatek sprayed barbecue fluid over a window of the Holyrood building and took out a lighter before being challenged by a "courageous" police officer on Saturday, March 24.

He pulled out a knife when approached by the officer, but dropped the blade after being tackled to the ground.

Swiatek was found guilty of attempted fire raising, possession of two knives and causing fear and alarm following a trial at Edinburgh Sheriff Court.

Sheriff Gordon Liddle sentenced him to 30 months imprisonment and a 12-month supervision order on Friday.

In a sentencing statement, published by the Judicial Office for Scotland, Sheriff Liddle said: "You caused a major security alert.

"There was no way the authorities could know whether they were dealing with a terrorist incident.

"I am sure that members of the public, at that very busy place on a Saturday, were alarmed."

He said part of Edinburgh's Royal Mile was closed as a result of the incident, adding "many security personnel were involved in the aftermath before an all clear could be given".

Giving an account of Swiatek's actions in his statement, Sheriff Liddle said the accused had been caught on camera, carrying a rucksack and approaching the Parliament with "seeming purpose", after travelling to Edinburgh from Livingston.

He took barbecue fluid from the rucksack and headed towards a window and bamboo poles attached to the outside of the building.

"You were seen to liberally spray the fluid over the window and bamboo poles," Sheriff Liddle said in the statement.

"It extended out to the ground. You then took out a lighter. A police officer who saw you acting strangely went to the inside of the window.

"Although you maintained in your evidence there was no ignition, it was his evidence that he saw you ignite the fluid on the ground. He said it lit but did not spread to the window.

He continued: "That courageous officer then left the building and challenged you. You drew a knife and raised it above your head.

"He immediately tackled you to the ground and the knife was dropped. He was told soon after by another to beware of the other knife tucked into your trouser waistband."

He said Swiatek had made a number of "conflicting suggestions" regarding his behaviour, including that he was drunk, and he intended to set himself on fire rather than the building.

It was also noted he was said to be "having a tough time in his personal life", but Sheriff Liddle said such "dangerous and cavalier" behaviour was unacceptable.

Swiatek was also banned from driving for 38 months and fined £900 after previously admitting a separate charge of drink driving.

He was found to be almost three times over the legal limit on an earlier date.