Alan Turing, a genius codebreaker who helped the Allies defeat the Nazis only to be chemically castrated by his own country for homosexuality, will be posthumously pardoned by the UK, almost 50 years after he took his own life.

Turing, considered one of the fathers of computer science, was instrumental in cracking the German ciphers and helping the Allies listen in on German communications. After being found guilty of gross indecency and sentenced to chemical castration, Turing committed suicide only two years after his sentence was carried out.

The government has up until this point refused to pardon Turing.

Liberal Democrat Lord Sharkey has rallied on behalf of Turing to get the government to change its mind. "The government knows that Turing was a hero and a very great man," he said, announcing the pardon. "They acknowledge that he was cruelly treated. They must have seen the esteem in which he is held here and around the world."

Over 49,000 gay men, all of them now dead, were convicted under Britain's 1885 Criminal Law Amendment Act. Many of them were chemically castrated. Last year, the government refused to pardon any of them.