A former doctor has been sentenced to three years and four months in prison for storing dozens of explosive ingredients and bomb-making instructions.

Faris al-Khori, originally from Syria, was arrested in Edinburgh last year when chemicals, poisonous materials, bolts and handwritten notes were discovered in a flat.

It was found that he had no links to terrorism and prosecutors accepted he had made no attempt to make an explosive device, but the 62-year-old pleaded guilty to being in possession of various items which could be combined to make explosive substances.

At the High Court in Edinburgh, al-Khori was sentenced to 40 months in prison.

Judge Lady Wolffe said: "The number and nature of the explosive substances and the places you chose to store them lead me to conclude there is no alternative to a custodial sentence.

"The sentence is one of five years but in light of your early plea I reduce it to 40 months.

"It will be backdated and I shall also impose a supervised release order for a period of 12 months."

The materials, which included acetone, hydrogen peroxide, mercury and lead picrate, were discovered in April last year after a fire in a communal area of a flat at Fidra Court in the Muirhouse area of Edinburgh.

Fire crews searching the building forced entry to a flat registered to al-Khori and found jars containing various powders. Castor beans, which can be used to make ricin, were also found.

The building was evacuated while the substances - some which were years old - were tested.

Handwritten notes and instructions which "appeared to be instructions on how to prepare explosives and bombs" were also discovered.

Further material was later unearthed at a property in Persevere Court, Leith, and explosives experts were called in again.

Al-Khori said the materials were used for cleaning and as fertiliser but in February he pleaded guilty to a breach of the 1883 Explosive Substances Act.

Passing sentence Lady Wolffe said it was accepted there was no terrorist offence committed.

She added: "While you have pled guilty, the schedule lists 41 substances found in your control.

"You assembled large quantities without lawful purpose and some were stored in a high rise flat in a densely populated area.

"They were only found by chance by the fire service."

Al-Khori, who has been the full-time carer for his wife, was born in Damascus and trained as a doctor in Iraq before moving to Austria.

He has been a British citizen since 1998 but has never practised medicine in the UK.

Speaking before sentence was passed, defence QC Brian McConnachie said: "What seems to be clear from the narrative and material is that it has been directly ordered from legitimate companies, mainly through Amazon.

"The material has always been delivered to domestic addresses and paid for by genuine credit cards registered to Mr al-Khori.

"It has always been done in the open and over a period of time. Many of the items have never been opened.

"It is difficult to understand the hoarding of this material but it does appear that he is someone who has some kind of academic interest in the materials.

"It seems he has accumulated materials with some kind of peculiar interest in the subject without ever intending to do anything or make anything."

Detective Superintendent David Gordon, who led the investigation, said: "This was a significant and complex inquiry for Police Scotland, to safely deal with these volatile items and seek to establish al-Khori's motives for storing them.

"A thorough investigation by the Organised Crime and Counter Terrorism Unit and Crown Office found no known links to terrorist offences and we believe Faris al-Khori was acting independently.

"However, he showed utter disregard for the occupants of both buildings.

"Thanks to the swift actions of our partners in the fire service and armed forces, we were able to quickly assess the contents of the flats and make them safe by removing a number of items for forensic examination or controlled explosion.

"Al-Khori's activities went unnoticed for many years, demonstrating the importance of community vigilance in our efforts to keep Scotland safe."

Lindsey Miller, the Crown Office's Procurator Fiscal for Organised Crime and Counter Terrorism, said: "The conviction of al-Khori is a good example of agencies working closely together to protect the public.

"Al-Khori possessed a significant number and volume of explosive substances across two properties in Edinburgh as well as recipes for explosives.

"We worked closely with Police Service of Scotland and other agencies to prepare the case to ensure that al-Khori was brought to justice.

"I want to reassure the people of Scotland that we take any such offences extremely seriously, and our specialist prosecutors will continue to treat them as an absolute priority."