A Royal Navy petty officer was jailed for eight years on Wednesday for trying to pass Britain’s nuclear submarine secrets to men he believed to be Russian spies.
Edward Devenney, 30, was told he had betrayed his country and his colleagues.
Mr Justice Saunders, sentencing him at the Old Bailey, said Devenney knew what he was doing when he met the two men in January.
He added: “He did supply details of movements and operations carried out and to be carried out by nuclear submarines.
“I am satisfied that in the wrong hands it was capable of affecting the operational effectiveness of nuclear submarines.
“This is a very serious case. The defendant was prepared to betray his country and his colleagues.”
Devenney, from Northern Ireland, had suffered as the result of a rape allegation of which he was later cleared.
But by January this year, when he met the men in London, Devenney was a “controlled and rational man”.
No damage had actually been done to national security because the Russians were in fact MI5 intelligence officers, but Devenney had not known that at the time.
Devenney pleaded guilty to breaching the Official Secrets Act by gathering classified information and misconduct by meeting the supposed spies.
Outside court, solicitor Richard Cannon read a statement on behalf of Devenney which said: “I am deeply sorry for the hurt and shame that I have brought on my family and loved ones.
“Prior to these events I gave the Royal Navy 11 and a half years of service and I deeply regret my actions and the effect they have had on the Submarine Service and colleagues.”
Mari Reid, unit head for the CPS counter-terrorism division, said: “This was a classic story of betrayal.
“Edward Devenney was employed by the Royal Navy to protect this country from potential threats to our security. Instead, he pursued a course of conduct likely to put his country at risk.
“We rely on the men and women of our armed forces to keep us safe. It is hard to imagine a greater breach of that role than Devenney’s actions.”
The court heard that Devenney rang the Russian Embassy in November last year, after what he said was a 12-hour drinking binge.
He thought he had been treated badly by the Royal Navy because he was not promoted to chief petty officer.
Two days later, he managed to get into a locked safe on board HMS Vigilant and take three photographs of part of a secret code for encrypted information.
The judge said: “The photographs could, with other information, have led to the breaking of the code.”
He added: “The defendant made determined efforts to enter into an agreement to supply secret information to representatives of another country.
“The reason he later gave for his actions was that he wished to get his own back on the Royal Navy who he considered had treated him badly.”
But the judge added: “The objective evidence is that the Royal Navy treated him well.”
Lord Carlile, for Devenney, read out a statement from him which said: “I would like to apologise for the shame I brought on the Royal Navy.”
He said Devenney had been “something of a blue-eyed boy” until things began to go awry.
The rape allegation led to a general collapse in Devenney’s behaviour.
Mark Dennis, prosecuting, said that by the end of last year Devenney was drinking heavily and suffered bouts of depression.
He asked for his training course for promotion to be deferred for a year.
But his absences without leave and conduct had led to a warning that he would be sacked if it continued.
In January he was told he would be discharged if his behaviour did not improve by April.
He met the two agents calling themselves Dimitri and Vladimir twice in January - once at the British Museum and then at a hotel.
Mr Dennis said: “The potential damage could have been considerable and could have harmed the safety and security of the United Kingdom.”
The communications engineer was arrested in March in Plymouth, Devon, where HMS Vigilant was undergoing a refit.
He had a high level of security clearance but was not authorised to get into the safe, which was locked and had a secret code.
The photographs held “the essential piece of the jigsaw” to encrypted material which, if compromised, would remove the ability of the submarine to “be deployed covertly and without detection”.
He had hidden the pictures on his laptop but had not passed them on when he was arrested.
Devenney had also offered to give the spies details of the movements of Vigilant, which included its plans to sail to Faslane in Scotland and then to the east coast of America for nuclear testing.
Mr Dennis said he had also offered information on another nuclear sub and on a previous secret mission by HMS Trafalgar on which he had served.
The hearing went into secret session halfway through to discuss the impact of his actions on national security.
After his arrest, he had been questioned about his motives.
Mr Dennis said: “He explained that he was disenchanted with his work and he wanted to hurt the Royal Navy.”
Devenney admitted collecting information for a purpose prejudicial to the safety or interests of the state between November 18 last year and March 7 this year.
Stuart Osborne, Metropolitan Police Deputy Assistant Commissioner and senior national co-ordinator of counter- terrorism, said: “Devenney abused his position of trust and responsibility by taking photographs of a top secret encryption system.
“His actions had the potential to cause substantial harm and damage to the security of the UK.”
According to reports, Devenney was cleared in 2010 of raping a woman with learning difficulties.
But the trial heard details of his sex life which included being unfaithful to his girlfriend.