The former director of GCHQ felt as betrayed by Iraq war whistleblower Katherine Gun as he did by KGB traitor Geoffrey Prime, it has emerged.
Sir David Pepper who forged a 30-year career at the Doughnut, made the controversial parallels during a Cheltenham Literature Festival debate at The Everyman theatre yesterday.
GCHQ translator Mrs Gun was charged with breaching the Official Secrets Act in 2003 after she leaked an email to the Observer newspaper.
It detailed a secret US operation to spy on UN Security Council members to try to force a second resolution in the run-up to the Iraq war – an operation Mrs Gun thought immoral. After eight months, the case against her collapsed.
Prime, a linguist and radio operator at the listening post in the 70s, was unmasked as a KGB spy after his wife Rona found a stash of child porn images at their home and went to the police. The raid uncovered Prime's Soviet spy kit.
Prime was jailed for 38 years for his treachery, including revealing to the KGB that Britain and America had cracked high-grade Soviet military codes.
The revelation led to Moscow changing its encryption methods, leaving western intelligence in the dark for almost a decade afterwards.
Sir David had spent an hour talking about the history of GCHQ from its origins in 1919 to the code-crackers at Bletchley Park, through the Cold War years and its counter-terrorism work in Afghanistan when two questions came from the audience.
How much had Prime's treachery damaged Britain's security, and what did Sir David think of the Katherine Gun case? He replied: "I remember when Prime was discovered.
"The shock within the organisation was tangible.
"We felt totally, totally betrayed because most of us were focused on keeping secrets about what we do.
"To discover again that there was someone among us that could do that was an absolute shock. Did Prime damage us? He was in a position to do very serious damage."
Sir David, who retired from GCHQ last year, described the Prime years as "a horrible horrible time".
"As for Katherine Gun – it was similarly horrible for similar reasons," he added.
"Everyone at GCHQ is focused on doing the job and the thought that someone out of our family – and I don't think the word family is too strong, when you have 5,500 people there it becomes like a family – would break that trust was truly shocking.
"One of the most distressing things was that we put in place quite substantial mechanisms for people that were having issues of conscience to air them, either through their line manager or a staff counsellor – not a civil servant. And she didn't make use of any of those mechanisms."
Sir David refused to be drawn on why the case against Mrs Gun, 29 at the time, collapsed.
He said: "It was an interesting issue of leadership for me. How do you deal with this issue when you are angry too?
"That she breached our trust was quite a profoundly shocking event."
More Literature Festival reviews on page 10