LONDON (Reuters) - A British Royal Navy submariner caught in a sting operation trying to pass military secrets to men he thought were Russian agents was jailed for eight years on Wednesday at London's Central Criminal Court.

Petty officer Edward Devenney, 30, from Northern Ireland, offered to hand over encryption codes and sailing dates of British nuclear submarines.

In reality, the agents he met were undercover MI5 officers from Britain's secret service, the court had heard.

Devenny, in the Navy for 11 years, appeared to be seeking revenge over dashed career prospects rather than financial gain.

He was secretly recorded complaining that a course he had been due to take had been "binned" and that he wanted to "hurt the Navy".

He had been in custody since his arrest in March this year in the southwestern English port of Plymouth, admitting at an earlier court hearing to breaking Britain's Official Secrets Act.

(Writing by Tim Castle; editing by Stephen Addison)