Story highlights Living men convicted can also seek pardons

Law named after British WWII codebreaker Alan Turing

London (CNN) Thousands of gay and bisexual men who were convicted of now-abolished sexual offenses in Britain have been posthumously pardoned under a new policing law, the Justice Ministry announced.

The "Turing law" received royal assent on Tuesday, the last stage in a bill becoming law in the United Kingdom. It gives an automatic pardon to men who died before the law came into force, and makes it possible for living convicted gay men to seek pardons for offenses no longer on the statute book.

British mathematician Alan Turing, aged 16 in 1928.

The law was named after World War II codebreaker and mathematician Alan Turing -- subject of the 2014 film "The Imitation Game" -- who killed himself in 1954 after he was subjected to chemical castration as punishment for homosexual activity.

In 2013, nearly 60 years later, he received a posthumous royal pardon from Queen Elizabeth II.

"This is a truly momentous day. We can never undo the hurt caused, but we have apologized and taken action to right these wrongs," Justice Minister Sam Gyimah said. "I am immensely proud that 'Turing's Law' has become a reality under this government."

Read More