A “despicable” Berlin embassy spy from Doonfoot has been jailed for more than 13 years for betraying his country and selling secrets to Russia.

David Smith, a former security guard at the British embassy in Germany, was motivated by his support for Russian President Vladimir Putin and hatred of the UK when he began collecting classified documents in 2018.

He sent two letters to senior officials at the Russian embassy in 2020, with one exposing the identity of a diplomat who had worked in Russia – referred to as X – as well as details of colleagues.

Police launched an investigation after Smith’s second letter to a military attache at the Russian embassy in November 2020 was traced back to him.

In an undercover sting operation in August 2021, two role players were deployed as a fake Russian defector and intelligence officer.

Smith, 58, who was born in Paisley and grew up in Ayr, pleaded guilty to eight charges under the Official Secrets Act by committing an act prejudicial to the safety or interests of the state.

The court was told of “potentially catastrophic” consequences for “each and every” British official in Berlin, with the cost to the taxpayer of updating security estimated at £820,000.

Embassy staff were left with “feelings of anger, betrayal and upset and concern at the implications of their details being shared with a hostile state actor”, the Old Bailey heard.

Smith’s spying could have harmed Britain’s international trade negotiations and came at a time the UK was “calling out” Russian actions, including amassing vast numbers of troops on the Ukraine border.

Smith may even have been directed by his handler when he filmed private offices, including photographs of colleagues’ family and friends on their desks.

In a televised sentencing at the court on Friday, Mr Justice Wall jailed ex-RAF serviceman Smith to 13 years and two months.

The senior judge said Smith began stealing secrets “by stealth” from the embassy at night in 2018 and had continued until his arrest in 2021.

He said: “You were fully aware that you should not have copied any of those documents and were equally aware that, were those documents to get into the wrong hands, they might harm British interests or pose a threat to the safety of people working at the embassy.”

In passing on photographs of embassy staff annotated with personal details, he put colleagues at “maximum risk”, the judge said.

Mr Justice Wall dismissed Smith’s expressions of remorse as “self-pity”, saying he failed to acknowledge the “potentially catastrophic consequences for others”.

Smith listened in the dock with the assistance of a hearing aid and gave no reaction as he was sent down.

Speaking outside court, Nick Price, from the Crown Prosecution Service, said: “David Smith, who just a few moments ago has been sentenced here to a substantial custodial sentence, was motivated by a combination of two things – greed and a hatred of our country.

“That hatred was palpable and led him into engaging in what only can be described as despicable behaviour.”

Previously, the court heard of the meticulous joint operation between British and German police and MI5 that led to Smith’s arrest.

On August 5 2021, Smith was asked by an embassy staff member to escort an undercover operative posing as Russian defector “Dmitry” into the building.

Smith made a copy of a document Dmitry had brought and kept Sim card packaging with the defector’s phone number on it rather than destroying it as he had been instructed.

Later in his security kiosk, Smith was shown on covert film using a small camera to record about 45 seconds of CCTV capturing Dmitry’s visit, saying: “If he works at the embassy they will know him.”

A few days later, Smith was accosted at a tram stop by fake Russian spy Irina, who said somebody was passing on information that was “damaging to Russia”.

He appeared sceptical, saying it had been “sprung on me” and he needed to speak to “someone”, in an apparent reference to his handler.

In his evidence, Smith said he was now “ashamed” at his behaviour and counted himself as a proud Scot.

He claimed he was angry at his employer, depressed and was drinking seven pints a day after his Ukrainian wife of 20 years returned to her home country.

Smith admitted being interested in conspiracy theories espoused by Alex Jones’ InfoWars and David Icke but denied being pro-Russian or having far-right sympathies.

However, the prosecution pointed out his collection of Russian military memorabilia, including a flag and large toy Rottweiler, as well as his past support for Russian-backed separatists in the Donbas.

Alison Morgan KC said a cartoon in Smith’s locker of Mr Putin with his hands around former German chancellor Angela Merkel’s neck summed up his pro-Russia stance.

It mirrored Mr Putin’s false narrative for invading Ukraine, the prosecutor said, adding: “It is precisely what Russia was saying as its justification for amassing vast amounts of troops on the border, and it is a cartoon that depicts Angela Merkel as a Nazi.”

Following the sentencing, Commander Richard Smith, head of the Met’s SO15 counter-terrorism command, described Smith’s actions as “reckless and dangerous”.

He said: “His offending is made worse by the fact that he was exploiting the privileged position and access that gave him.

“In the case of Dmitry, the role player, if that person had been authentic, the information Smith sought to gather about him, if shared, might have put him at very significant risk.”