Second World War code-breaker Alan Turing has been given a posthumous royal pardon for a 61-year-old conviction for homosexual activity.
Campaigners said the news was "the perfect Christmas present" but there were calls for the same treatment for around 50,000 more people who suffered the same fate.
Dr Turing, who was pivotal in breaking the Enigma code, arguably shortening the Second World War by at least two years, was chemically castrated following his conviction in 1952.
His conviction for "gross indecency" led to the removal of his security clearance and meant he was no longer able to work for Government Communications Headquarters (GCHQ) where he had continued to work following service at Bletchley Park during the war.
Dr Turing, who died aged 41 in 1954 and is often described as the father of modern computing, has been granted a pardon under the Royal Prerogative of Mercy by the Queen following a request from Justice Secretary Chris Grayling.
"Dr Alan Turing was an exceptional man with a brilliant mind," Grayling said.
"His brilliance was put into practice at Bletchley Park during the Second World War where he was pivotal to breaking the Enigma code, helping to end the war and save thousands of lives.
"His later life was overshadowed by his conviction for homosexual activity, a sentence we would now consider unjust and discriminatory and which has now been repealed.
"Dr Turing deserves to be remembered and recognised for his fantastic contribution to the war effort and his legacy to science. A pardon from the Queen is a fitting tribute to an exceptional man."
Dr Turing died of cyanide poisoning and an inquest recorded a verdict of suicide, although his mother and others maintained his death was accidental.
There has been a long campaign to clear the mathematician's name, including a well-supported e- petition and private member's bill, along with support from leading scientists such as Sir Stephen Hawking.
The pardon under the Royal Prerogative of Mercy will come into effect today.
The Justice Secretary has the power to ask the Queen to grant a pardon under the Royal Prerogative of Mercy, for civilians convicted in England and Wales.
A pardon is only normally granted when the person is innocent of the offence and where a request has been made by someone with a vested interest such as a family member. But on this occasion a pardon has been issued without either requirement being met.
In September 2009, then-prime minister Gordon Brown apologised to Dr Turing for prosecuting him as a homosexual after a petition calling for such a move.
An e-petiton - titled "Grant a pardon to Alan Turing" - received 37,404 signatures when it closed in November last year.
The request was declined by Lord McNally on the grounds that Dr Turing was properly convicted of what at the time was a criminal offence.
Prime Minister David Cameron said: "Alan Turing was a remarkable man who played a key role in saving this country in World War Two by cracking the German Enigma code.
"His action saved countless lives. He also left a remarkable national legacy through his substantial scientific achievements, often being referred to as the father of modern computing."
Liberal Democrat peer Lord Sharkey, who introduced the private member's bill in the House of Lords calling for a royal pardon, said it was "wonderful" news.
"This has demonstrated wisdom and compassion. It has recognised a very great British hero and made some amends for the cruelty and injustice with which Turing was treated," he said.
"I will continue to campaign for all those convicted as Turing was, simply for being gay, to have their convictions disregarded.
Gay rights campaigner Peter Tatchell said that the granting of the royal pardon was "long overdue" and called for the same treatment to be given to others convicted in similar circumstances.
"An apology and pardon is due to another 50,000-plus men who were also convicted of consenting, victimless homosexual relationships during the 20th century."