A man caught trying to buy a gun online from the US has been jailed for five years after being snared in a joint police operation.

David Mitchell spent more than £2,000 of cryptocurrency on a Glock 9mm gun with magazine, silencer and 150 rounds of 9mm ammunition.

A court heard he was driven by an “obsessive preoccupation” to explore whether the transaction was possible via the dark web.

The 48-year-old, from Damside in Edinburgh, admitted three firearms offences when he appeared at the city’s high court last month.

He returned to the court on Monday, when he was handed the five-year jail term.

David Mitchell has been jailed for five years (Police Scotland/PA)

Passing sentence, judge Lord Pentland said: “It appears that you formed a plan to obtain these items by carrying out research on the dark web and then proceeding to order them for delivery to this country from the United States.

“Fortunately, due to cooperation between the police forces of both countries, your plan was thwarted and the items were intercepted.

“It appears that your decision to acquire the gun and the other items arose from an obsessive preoccupation on your part with exploring whether it was possible to do so by making use of the dark web.

“You claim that you had no intention of causing harm to anyone but the fact remains that you went to considerable lengths to get hold of a potentially lethal weapon and ammunition.

“You must have appreciated that this was unlawful. For this conduct you must be punished.”

The court heard Mitchell has a history of depression and other behavioural difficulties.

Defence QC John Scott said he had been described as a valued and dependable employee and has no previous convictions.

The work of Operation Dive is said to mark a milestone for the Organised Crime Partnership (Scotland), which began just weeks before officers received information on Mitchell’s activity on September 19.

Experts decided the OCP(S), a collaboration between Police Scotland and the National Crime Agency (NCA), would take lead on the case under their remit of tackling serious and organised crime.

The gun was seized at the point of exit from the US, where officers informed the NCA and Police Scotland, which led to the OCP(S) involvement.

A fake parcel known as a “placebo” was delivered to his work address at Pitreavie Court in Dunfermline, Fife, instead of an actual firearm, to ensure public safety.

Glock 9mm gunDavid Mitchell spent more than £2,000 of cryptocurrency on a Glock 9mm gun with magazine, silencer and 150 rounds of 9mm ammunition (Police Scotland/PA)

Specialist officers carried out surveillance until the software engineer drove home in his green Skoda with the partially opened package in the boot of the vehicle.

When Mitchell arrived there, officers assessed the scene and minutes later they entered with a search warrant to find the package opened in the kitchen, beside some household tools, and the placebo found underneath a couch in his living room.

He offered no information on his motivations during questioning and appeared at court in Scotland on September 21 while the incident was reported to US Homeland Security.

Mitchell was described by Detective Inspector Tom Gillan of Police Scotland as a meek, well-mannered individual who lived alone with no partner or children.

SilencerDavid Mitchell spent more than £2,000 of cryptocurrency on a Glock 9mm gun with magazine, silencer and 150 rounds of 9mm ammunition (Police Scotland/PA)

Detective Chief Superintendent Gerry McLean, who heads Police Scotland’s organised crime and counter-terrorism unit, praised the work of the OCP(S) which is based at the Scottish Crime Campus in Gartcosh, North Lanarkshire.

He said: “David Mitchell never offered any information that would have allowed us to better understand what his motivation was to securing a firearm.

“Our priorities are public safety and trying to understand what factors are, is it part of a wider network of individuals.

“That’s something Tom and the team continue to work on.

“For a number of years now we’ve been working in that multi-agency environment, we’ve talked about collaboration and partnerships.

“But actually where the crime campus and the ethos of the campus have both been demonstrated by Police Scotland is a subtle shift into integration.

“Having that blend and mix towards what is a shared ambition and aspiration to tackle organised crime, whether it sits here in Scotland or impacts on Scotland, I think is the real benefit that comes from it.”