The Queen and the Duke of Edinburgh yesterday unveiled a monument to commemorate the contribution made by code breakers at Bletchley Park to victory over Nazi Germany in the Second World War. In particular, The Queen paid tribute to the gay codebreaker Alan Turing, who was later forced to undergo chemical castration after being convicted of homosexuality.

The Royal Party toured the museum where restoration projects have taken place to rebuild the machines which assisted with the wartime decryption of enemy codes. These included the Turing Bombe, brainchild of mathematical genius Alan Turing, and Colossus, the world’s first electronic computer. The machines were used to decode German messages sent using their Engima machines.

The Queen said: “It is impossible to overstate the deep sense of admiration, gratitude, and national debt that we owe to all those men and, especially, women. They were called to this place in the greatest of secrecy – so much so that some of their families will never know the full extent of their contribution – as they set about on a seemingly impossible mission; a massive challenge in the field of cryptanalysis: for the first time pitting technology against technology.

“And so, these huts and buildings became the centre of a world-wide web of intelligence communications, spanning the Commonwealth and further afield.

“This was the place of geniuses such as Alan Turing. But these wonderfully clever mathematicians, language graduates and engineers were complemented by people with different sets of skills, harnessing that brilliance through methodical, unglamorous, hard slog. Thus the secret of Bletchley’s success was that it became a home to all the talents.”

Turing killed himself in 1954 aged 41 after being convicted of having a sexual relationship with another man.

A British court gave him the choice of going either to prison or undergoing chemical castration. He opted for the latter which involved high dosage injections of female hormones. He committed suicide two years later.

In 2009, after a campaign led by Richard Dawkins, Stephen Fry, Peter Tatchell and supported by PinkNews.co.uk, 30,805 people demanded that the then prime minister Gordon Brown issued an apology for Turing’s treatment on behalf of the British government. Mr Brown agreed to do so.

In his apology, Mr Brown wrote: “Thousands of people have come together to demand justice for Alan Turing and recognition of the appalling way he was treated. While Turing was dealt with under the law of the time and we can’t put the clock back, his treatment was of course utterly unfair and I am pleased to have the chance to say how deeply sorry I and we all are for what happened to him. Alan and the many thousands of other gay men who were convicted as he was convicted under homophobic laws were treated terribly. Over the years millions more lived in fear of conviction.

“I am proud that those days are gone and that in the last 12 years this government has done so much to make life fairer and more equal for our LGBT community. This recognition of Alan’s status as one of Britain’s most famous victims of homophobia is another step towards equality and long overdue.

“But even more than that, Alan deserves recognition for his contribution to humankind. For those of us born after 1945, into a Europe which is united, democratic and at peace, it is hard to imagine that our continent was once the theatre of mankind’s darkest hour. It is difficult to believe that in living memory, people could become so consumed by hate – by anti-Semitism, by homophobia, by xenophobia and other murderous prejudices – that the gas chambers and crematoria became a piece of the European landscape as surely as the galleries and universities and concert halls which had marked out the European civilisation for hundreds of years. It is thanks to men and women who were totally committed to fighting fascism, people like Alan Turing, that the horrors of the Holocaust and of total war are part of Europe’s history and not Europe’s present.

“So on behalf of the British government, and all those who live freely thanks to Alan’s work I am very proud to say: we’re sorry, you deserved so much better.”