Richard Hayes worked for months to solve the “Görtz Cipher” – a fiendish Nazi code that had stumped some of the greatest code-breaking minds at Bletchley Park

An unassuming Irish librarian has been credited as a codebreaker who helped to alter the course of World War II.

The Hollywood movie 'The Imitation Game' brought to the big screen the work of mathematicians at Bletchley Park in England who decrypted Morse code messages from German spies.

But a lone Irish code-breaking genius, Dr Richard Hayes, was back in Dublin during the conflict helping to crack near-impossible ciphers from Berlin agents.

The Documentary On One: 'Richard Hayes, Nazi Codebreaker', which will be aired today on RTÉ Radio 1 at 2pm, reveals how his ingenious plan to take a pair of trousers belonging to an imprisoned German spy without his knowledge helped him solve the key to coded messages being transmitted back to Berlin.

Mark Hull, a serving member of the US Army and military historian, told the documentary that the prolific codebreaker is widely recognised for his brilliance in intelligence circles.

"The tragedy here is he was lost in terms of the Irish public," Mr Hull said.

"People in the intelligence services - Irish, American, British and certainly Allied intelligence services -understood and recognised his contribution for being as significant as it was.

"I think in large measure he kept Ireland safe."

During wartime Europe, Dr Hayes and Colonel Dan Bryan, the head of Ireland's intelligence service G2, led the secret Irish counter intelligence war to decode wireless messages being covertly transmitted through Morse code from a house in north Dublin owned by the German Embassy.

Dr Hayes worked for months to solve the "Görtz Cipher" - a fiendish Nazi code that had stumped some of the greatest code-breaking minds at Bletchley Park.

It was a code used by German spy Dr Herman Görtz, who had been captured by gardaí and held in Arbour Hill Prison after parachuting into Co Meath a year earlier.

Dr Hayes, who was director of the National Library, tricked Görtz into getting an X-ray during one of his weekly visits to see him in jail so he could find his cipher in his trouser pockets and spent months trying to crack it.

He and Colonel Bryan intercepted messages from the spy and sent their own messages back to him to dupe him into revealing more information. This was then passed on to Bletchley Park. Dr Hayes has been referred to by British security service MI5 as Ireland's "greatest unsung hero" and the Office of Strategic Services in the US said he was "a colossus of a man", yet due to the secret nature of his work he is virtually unheard of in his own country.

"The heroic thing about this with both Dan Bryan and Dr Hayes is that they are doing this in some measure without their own government's approval or knowledge," Mr Hull said.

"Without Dr Hayes I think we could have well had a different outcome to World War II."

Yvonne Hayes, the daughter-in-law of the unassuming Limerick man, said British leader Winston Churchill did honour Dr Hayes for his genius.

"At the end of the war he went to England but it had to be hush, hush because Ireland was neutral. He got some medal from Churchill, but it couldn't be ever announced or anything.

"He wouldn't have been a man who was shouting his things for the hilltops. He was a doer and moved on."

Irish Independent