Thousands of British men convicted of homosexuality before its decriminalisation are to be pardoned under the "Turing Law", named after World War II hero Alan Turing, the UK government has said.
Anyone alive who was convicted of consensual same-sex acts before the law was abolished can already apply to have their names cleared through the "disregard process", and will now receive an automatic pardon.
Thousands of deceased people will also receive an automatic pardon.
"It is hugely important that we pardon people convicted of historical sexual offences who would be innocent of any crime today," said Minister for Prisons and Probation Sam Gyimah.
"Through pardons and the existing disregard process we will meet our manifesto commitment to put right these wrongs."
Private homosexual acts between men aged over 21 were decriminalised in England and Wales in 1967, but the law was not changed in Scotland until 1980 and in Northern Ireland until 1982.
Homosexuality was decriminalised in the Republic in 1993.
Turing was a computer scientist, philosopher and cryptologist who played a crucial role in breaking the Nazi Enigma code at Britain's Bletchley Park, which was recently dramatised in cinemas in "The Imitation Game".
He was prosecuted for homosexuality in 1952 and forced to undergo chemical castration. He killed himself in 1954 at the age of 41.
Turing was officially pardoned in 2013, triggering calls for blanket pardons.
Liberal Democrat lord John Sharkey, who introduced the bill to clear Turing, said the announcement heralded "a momentous day for thousands of families up and down the UK".
"It is a wonderful thing that we have been able to build on the pardon granted to Alan Turing," he told the BBC.
Another of those prosecuted under the legislation used against Turing was Irish playwright Oscar Wilde in 1895 during a Victorian clampdown on homosexuality. He was sentenced to two years labour.
However, the Guardian newspaper said it was not clear whether Wilde would be included in those pardoned as the Ministry of Justice has said that no new individuals would be named or singled out.
One man who was convicted of gross indecency in 1974, said he would not accept a pardon and wanted an apology.
"To accept a pardon means you accept that you were guilty. I was not guilty of anything. I was only guilty of being in the wrong place at the wrong time", George Montague told the BBC.