Petty officer Edward Devenney, 30, from Northern Ireland, pleaded guilty at the Old Bailey yesterday to gathering details of encryption programmes and misconduct in a public office.
He contacted a foreign embassy to try to pass to Russia “crypto material” - programmes used to encrypt secret information - and information linked to the operation of HMS Trafalgar and two nuclear submarines.
But the two people he eventually met with were from British secret services.
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. He gathered details of programmes used to encrypt secret information.
Devenney denied a second count of communicating information to another person and this will not be pursued by prosecutors.
He will be sentenced on December 12, when parts of the hearing will be held in secret.
Remanding Devenney in custody, Mr Justice Saunders said: “Your sentence will be adjourned to December 12 when I will hear all the matters and consider them all.”