LONDON, Feb. 01 (Xinhua) -- Almost 50,000 British men convicted of offences under former anti-gay laws were granted posthumous pardons on Tuesday.

Queen Elizabeth gave Royal Assent to a new bill which pardons any men of any sexual acts that are no longer crimes in England and Wales.

The pardons only apply to men who are no longer living, but men still alive who have criminal convictions can apply on an individual basis to have their names cleared.

Government Justice minister Sam Gyimah described the outcome as a "truly momentous day".

Gyimah said: "We can never undo the hurt caused, but we have apologized and taken action to right these wrongs."

The London Gay rights charity Stonewall described the pardons as another important milestone in equality.

The measure, under the Policing and Crime Bill, is known as the Turing Law and follows the granting of a pardon to the World War II hero in 2013.

Turing worked as a wartime code breaker at top-secret Bletchley Park, famed for breaking the German war machine's enigma code. He is credited with saving thousands of lives because of the ability of the British military to read coded messages.

After the war Turing was convicted of an offence known as gross indecency because of a relationship with another man. Rather than live with chemical castration as part of a punishment, he killed himself in 1954.

In a society with changing attitudes towards gay, bi-sexual and transgender people, former Labor prime minister Gordon Brown issued a formal public apology in 2009 to Turing for the way he had been treated.