Germany is set to rescind the convictions of 50,000 men sentenced for homosexuality under a Nazi-era law.

Chancellor Angela Merkel’s government is expected to pass the law today, which will set aside 30 million euros to compensate an estimated 5,000 convicted men who are still alive.

“We can never completely erase the travesty of justice, but we want to rehabilitate the victims,” Justice Minister Heiko Maas told AFP.

Paragraph 175 was part of Germany’s criminal code until 1994 and made sex between men illegal. More than 140,000 men were convicted under this paragraph, and 50,000 were prosecuted.

Fritz Schmehling, 74, was convicted under the law as a teenager in 1957.

“I don’t want to die with a criminal record,” he told AFP at his flat in Berlin.

“I’ve had cancer twice,” said Schmehling, “and was operated on but maybe I will still get to enjoy the moment my name is cleared. As sad as it is, in the time it takes, many of the older ones among us are going to die.”

The process to quash these convictions began in May, and follows the UK’s move earlier this year to pardon thousands of men under Turing’s Law.

Germany initially banned gay sex in 1871, when a penal code was introduced criminalising homosexual acts. This law was extended under the Nazis to convict thousands of gay men and send them to concentration camps.

The laws were not repealed in West Germany after the fall of the Nazis, and many of the persecuted gay men were not cleared.

Homosexuality was not legalised until 1968 and 1969 in East and West Germany respectively. The age of consent was finally equalised in 1989.

The legislation comes after pressure from LGBT organisations in the country, who have urged the changes to be brought in quickly – so that some of the men will see their names cleared in their lifetimes.