A move to pardon thousands of gay and bisexual men previously convicted of now abolished same-sex offences has been hailed as "putting right a cruel and unjust historic wrong".
Under the "momentous" step, backed by the Government, posthumous pardons will be granted to all those convicted of relevant offences who have since died.
Those still alive will also be eligible for a pardon where offences have been successfully deleted through the disregard process.
The historic measure comes after Second World War code-breaker Alan Turing was given a posthumous royal pardon in 2013 over a conviction in 1952 for gross indecency with a 19-year-old man.
Turing was chemically castrated and died two years later from cyanide poisoning in an apparent suicide - though there have been suggestions his death was an accident.
Amendments have now been agreed to the Policing and Crime Bill to bring about the wider change.
The provisions allow for pardons in respect of convictions for now abolished offences involving consensual activity with persons over the age of consent.
Liberal Democrat peer Lord Sharkey, who was instrumental in securing the pardon for Turing, proposed the amendments.
He told peers: "There was a feeling that if Turing were pardoned it would be morally impossible not to extend that to all hose others similarly convicted but now dead.
"And so it would prove if these amendments now pass.
"If they do pass we will finally be putting right a cruel and unjust historic wrong.
"A wrong that has wrecked the lives of thousands of gay men."
The amendments were also backed by Home Office Minister Baroness Williams of Trafford who said: "This historic step is a momentous one in righting the wrongs suffered by thousands of gay and bisexual men.
"It is a tragedy that people were criminalised over a shamefully long time for what society regards as normal sexual activity today.
"It's time to right the wrongs of the past and I am very pleased to be able to support Lord Sharkey in putting forward these amendments."
Peers backed the proposals at the committee stage of the Bill.