Thousands of gay and bisexual men found guilty of decades-old sexual offences in England and Wales have been posthumously pardoned.
The enactment by the government of the so-called Alan Turing law means about 49,000 men will be cleared of crimes of which they would be innocent today.
Wartime code-breaker Turing was pardoned in 2013 for gross indecency.
Statutory pardons will also be granted to people still living who apply to have their convictions removed.
The pardons were first announced last year and have now been officially rubber-stamped after the Policing and Crime Bill received Royal Assent.
The men were found guilty of committing now-abolished offences while in consensual relationships.
Justice minister Sam Gyimah said it was a "truly momentous day".
He said: "We can never undo the hurt caused, but we have apologised and taken action to right these wrongs."
Mathematician Turing was given a royal pardon in 2013, nearly 60 years after his suicide in 1954.
The pardon addressed his 1952 conviction for gross indecency, after which he was chemically castrated.
This followed an official apology by former Prime Minister Gordon Brown in 2009 for how Alan Turing had been treated.
His relatives later mounted a high-profile campaign to secure pardons for other men similarly convicted under historical indecency laws.
Laws against homosexual activity before 1967
- Gross indecency with another man: introduced in 1885 and used to prosecute men where sodomy could not be proven
- Buggery: first used as an offence in 1533 and remained a capital offence until the 19th Century
(Source: Sexual Offence Act 1956, England and Wales)
Gay rights charity Stonewall said: "Another important milestone of equality has been secured in law.
"The more equality is enshrined into our law books, the stronger our equality becomes, and the stronger we as a community become."
Liberal Democrat peer Lord Sharkey, whose amendment to the Policing and Crime Bill was instrumental in securing the change, said it was a "wonderful thing" that Mr Turing's pardon could be extended to other men "unjustly convicted".
Liberal Democrat leader Tim Farron said: "Although it comes too late for those convicted, the friends and relatives of the thousands of people who suffered under this unfair and discriminatory law will now have a weight lifted off their shoulders."
Rights campaigner Peter Tatchell said the pardon was an "important, valuable advance that will remedy the grave injustices suffered by many of the estimated 50,000 to 100,000 men who were convicted under discriminatory anti-gay laws".
But he said it was "unclear" whether only the relatives of a deceased man could apply for a pardon on their behalf.
"Many convicted men were rejected and disowned by their families," he said.
"The government should make it clear that any concerned person, including personal friends, can apply for a pardon for a deceased person."