The head of the UK's Government Communications Headquarters (GCHQ) has formally apologized for a ban on homosexuals which led to the dismissal and subsequent suicide of one of its best-ever code breakers, Alan Turing, in the 1950s.

Speaking on Tuesday, Robert Hannigan told a gay rights workplace conference in London that Turing had been an example to others as he had not been afraid to think "differently and radically."

Alan Turing portrait at the National Gallery

"[I want to] say how sorry I am that he and so many others were treated in this way," Hannigan said. "Their suffering was our loss." GCHQ's ban on homosexuals was only lifted in the 1990s. The life of Turing was featured in a recent film with Benedict Cumberbatch "The Imitation Game.'

"To do our job, which is solving some of the hardest technology problems the world faces for security reasons, we need all talents and we need people who dare to think differently and be different," Hannigan said.

While Turing, and other gay men were regarded as security risks by their employers, the UK's domestic spy agency MI5 was recently rated the country's most gay-friendly employer by campaign group Stonewall. Six years ago it was ranked 134 on the index.

A scene from 'The Imitation Game'

Now with an outward presence on Twitter

GCHQ rarely makes public pronouncements and so its entry to the world of social media made Monday a double-first. "We want GCHQ to be more accessible and to help the public understand more about our work," an unnamed spokesperson said. "We also want to reach out to the technical community and add our voice to social media conversations about technology," maths and cyber-security.

The agency's first tweet "Hello, world" came with a background image of its ring-shaped building in Cheltenham, known locally as the "doughnut."

GCHQ presented itself as an agency "Where our brightest people bring together intelligence and technology to keep Britain safe."

The US Central Intelligence Agency, which joined Twitter in February 2014 and boasts 1.36 million followers, was concise in its welcome:

Within four hours, GCHQ was testing the mental agility of its 16,300 new Twitter followers with a soccer-doku puzzle based on England and Wales' group in the upcoming Euro 2016 tournament in France:

Others reflected on who the spy agency would follow from its official account, starting with a famous and fictitious operative:

jm/msh (Reuters, AFP)