British Prime Minister Gordon Brown yesterday apologised for the treatment of World War II codebreaker Alan Turing who committed suicide after being convicted and chemically castrated for being a homosexual.

Mathematician Turing led a team at Bletchley Park country House north of London which cracked the Nazis' Enigma code - regarded by the Germans as unbreakable - a move credited with helping to shorten the war and save countless lives.

However, five years after the war he was convicted of gross indecency under laws which banned homosexuality and was sentenced to chemical castration involving a series of injections of female hormones.

The conviction meant Mr Turing, a pioneer of modern computing, losing his security clearance and being unable to continue his work. In 1954 he killed himself at the age of 41.

Following a petition signed by more than 30,000 people on the website of Mr Brown's Downing Street office, calling for an apology, the Prime Minister issued a statement expressing the government's sorrow for Mr Turing's "appalling" treatment.

"It is no exaggeration to say that, without his outstanding contribution, the history of World War II could well have been very different," Mr Brown said. "The debt of gratitude he is owed makes it all the more horrifying, therefore, that he was treated so inhumanely."

Mr Turing, Mr Brown said, had deserved "so much better".

"While Mr 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," he said.

"Alan and the many thousands of other gay men who were convicted as he was convicted under homophobic laws, were treated terribly."

The legislation used against the maths genius was the same as that used to prosecute and jail playwright Oscar Wilde in 1895 during a Victorian clampdown on homosexuality and it was only repealed in 2003, gay rights campaigners said.

Computer programmer John Graham-Cumming, who organised the online petition for Mr Turing, said he had been surprised by the support he had received and the government's response.

"I wanted Alan Turing to be raised into the pantheon of great Britons, but I felt it would be hypocritical to do so without recognizing that Britain treated him so badly," he said.

He has written to Queen Elizabeth to ask her to grant Mr Turing a posthumous knighthood for his wartime work and called for the government to provide investment to preserve Bletchley Park and set up a National Museum of Computing there in Mr Turing's name.

It was at the site that Mr Turing and fellow scientists designed and developed Colossus, a truck-sized machine which was one of the world's first programmable electronic computers.

However, the work was not widely known beyond academic circles as Britain kept their role in the war secret.

Then Prime Minister Winston Churchill ordered that the Colossus computers and 200 so-called Bombe machines, used to crack the Enigma code, be destroyed to keep them secret from the Soviet Union.

Bletchley's existence only came to light in the 1970s when the veil of secrecy was lifted.

Sign up to our free newsletters

Get the best updates straight to your inbox:
Please select at least one mailing list.

You can unsubscribe at any time by clicking the link in the footer of our emails. We use Mailchimp as our marketing platform. By subscribing, you acknowledge that your information will be transferred to Mailchimp for processing.