THE head of the Dorset school where World War II code-breaker Alan Turing studied has welcomed Gordon Brown’s apology for the punishment which drove the gifted scientist to suicide.

The Prime Minister yesterday admitted that the punishment given to the brilliant mathematician because he was gay was horrifying and inhumane.

Simon Elliot, head of Sherborne School, where Turing studied from 1926-31, said: “He was treated appallingly as an individual. We are extremely proud of the fact that he studied here and that he did so well.”

Turing, who is most famous for helping to create the device that cracked messages enciphered with the German Enigma machines, was convicted of gross indecency in 1952 after admitting a sexual relationship with a man.

He committed suicide two years later, aged 41, after he was sentenced to chemical castration.

Sherborne School has a building on the site named after him.

Mr Eliot added: “He is probably the most distinguished previous member of the school and without him, computers would not be what they are today.”

The PM’s apology follows a Downing Street petition signed by more than 30,000 including novelist Ian McEwan, scientist Professor Richard Dawkins and gay rights campaigner Peter Tatchell.

Gordon 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.”