A portrait of Alan Turing from an archive of papers relating to the development of computing at the National Physical Laboratory between the late 1940s and the early 1970s. (Science Museum, London/SSPL)

By all accounts, Alan Turing was a genius. At age 15, he wrote an abridged version of Einstein's theory of relativity for his mother. By 22, he was cracking long-unsolved conundrums that had vexed Europe's most cunning mathematicians. By the onset of World War II, he'd become the British military's most brilliant code breaker. He is credited with deciphering the Nazis' “Enigma” code, which they used to communicate war plans in secret. Historians say that breakthrough shortened the war by two years at the very least. Without Turing, the war may not have played out as it did. Millions more people could have died.

But as soon as the British police found out Turing was gay, they stripped him of his security clearance. Such “gross indecency” was against the law in Britain in 1952. It came with jail time. Because he was doing such important work — developing computer prototypes — Turing was offered an alternative to jail. He could take estrogen injections that would supposedly eliminate his perversion. Two years later, he ate an apple laced with cyanide.

Homosexuality wasn't decriminalized in England and Wales until 1967, with Scotland and Northern Ireland following more than a decade later. Tens of thousands of gay and bisexual men were convicted of “gross indecency.” On Wednesday, the British government announced that it would posthumously pardon those who had been convicted but had died since. Dubbing it the “Alan Turing law,” the pardons would be achieved through an amendment to a bill that originally criminalized homosexuality. Government officials also encouraged those convicted who are still alive to come forward and have their charges deleted.

The move amounts to an apology, albeit a late one. Turing was granted a royal pardon in 2013, 61 years after his conviction.

Speaking to the Independent, Rachel Barnes, Turing's great-niece and champion of the cause, said: “This is a momentous day for all those who have been convicted under the historic laws, and for their families. The gross indecency law ruined peoples’ lives. As Alan Turing received a pardon, it is absolutely right that those who were similarly convicted should receive a pardon as well. It is great news for all those who have worked so hard for years to bring about this new legislation.”

Read More:

Kenyan court rules anal exams to test sexual orientation are legal

Here are the 10 countries where homosexuality may be punished by death

Botswana deports American anti-gay pastor after radio hate speech