Code-cracker supreme – An Irishman’s Diary about the Limerick-born librarian whose cryptoanalysis helped defeat the Nazis

One morning in May 1947, a German wartime spy named Hermann Görtz was brought to the Aliens' Office in Dublin Castle and told he would be deported home next day. Although Ireland had requested that he not be handed over to the Soviet occupiers there, Görtz did not trust any assurances. He feared his fate under the communists.

And what happened next was recorded by The Irish Times. First he "stared disbelievingly at the detective officers". Then "he took his hand from his trouser pocket, swiftly removed his pipe from between his lips, and slipped a small glass phial into his mouth". Before gardaí could stop him, he had crunched the glass and swallowed most of the contents, collapsing in seconds.

Görtz's death was the last chapter in a wartime intrigue that had begun when he parachuted into a field in Meath seven years earlier, wearing a Luftwaffe uniform complete with his medals from the first World War. And his nemesis, as an RTÉ radio documentary will remind listeners this weekend, was a West Limerick-born veteran of the War of Independence, Richard Hayes.

Most listeners will need reminding, because Hayes has been all-but forgotten by posterity. But he was a code-breaker of genius, the equal of anyone in Britain’s famous Bletchley Park operation. Moreover, although his primary allegiance was to Irish military intelligence, his successes were also shared with the British.


They thereby became a key part of the work that, it has been argued, shortened the war by two years. According to his daughter, quoted in the documentary, Hayes later visited England, met Churchill, and was given “some medal”.

But like most of his life, that was a deliberately low-key event.

Although the Germans knew him as "Captain Gray", Hayes was no soldier. Far from it, he was a librarian, albeit a senior one – director of the National Library from 1940. It was under this cover that he was recruited by Col Dan Bryan (not to be confused with Dan Breen), head of "G2", Ireland's intelligence service.

These were interesting times for the organisation. Britain had recently complained of radio transmissions from the German legation in Dublin 4 and ciphers had been found on another captured spy here. So with the support of Eamon de Valera, who – political considerations aside – always had a big interest in maths, Hayes was given an office and staff to go to work on the German codes.

Görtz was arrested eventually too. He had liaised with the IRA and enjoyed the run of the country for a year, thanks (it is suspected) to political protection, and also to a network of safe houses provided by “ladies with republican leanings”. But he was picked up in late 1941.

In time, his ciphers too were being studied by Hayes.

Another German spy here, Günther Schultz, had used an uncoded system of “microdots”, allowing tiny messages to be contained within the letter “O” in newspaper cuttings. Hayes cracked that too. But Görtz’s system was a complex substitution of figures for letters that had baffled even the Bletchley boffins before he decoded it. In one case, the name “Cathleen Ni Houlihan” was the key.

Once able to read his intercepted messages, in classic espionage style, G2 started replying to them, posing as his superiors: encouraging and misinforming him simultaneously. In a sadistic touch, they even awarded him a promotion at one point. But all is fair in love and espionage, and Hayes’s work helped ensure both that Ireland stayed out of the war and that the right side won.

Released from prison in 1946, Görtz remained here, working for a time as press officer for a charity called Save the German Children. Then he was rearrested, with fatal consequences.

As reported by this newspaper, his funeral was attended by, among others, Dan Breen TD (not to be confused with Dan Bryan). A swastika was draped over the coffin at Deansgrange, where some admirers gave the Nazi salute.

Exhumed in 1974, Görtz’s remains now rest in the German military cemetery at Glencree, where fresh flowers still appear on his grave.

As for Hayes, his postwar obscurity was helped by the destruction of official files on the period. But Marc McMenamin's documentary – Richard Hayes, Nazi Codebreaker – is an attempt to bring this fascinating story back into the light. The programme will be available on the RTÉ website from tomorrow and will also be aired as part of Radio 1's Documentary on One series, on Saturday at 2pm.