The Prime Minister has praised late computer genius, mathematician and codebreaker Alan Turing for his “remarkable” and “vital” role in winning World War Two.

The Queen on 23 December granted a posthumous pardon to the gay hero Alan Turing under the Royal Prerogative of Mercy.

Speaking at Prime Minister’s Questions this afternoon, David Cameron was asked by Ian Stewart, MP for Milton Keynes South, whether he would like to visit Bletchley Park, the estate at which codebreaking efforts were based during the War, thanking him, and others for efforts in working towards the pardon.

He said: “The Royal Pardon granted to Alan Turing two weeks ago has finally seen justice for this national hero.

“May I thank the Prime Minister, the Justice Secretary and everyone over the years who has paved the way to bring this about, and may I invite my right honourable friend to visit Blechley Park in my constituency and see for himself Alan Turing’s remarkable achievement.

Mr Cameron responded: “I absolutely back what my honourable friend has said, I think it is excellent news that this royal prerogative mercy, which is very rarely granted,has been granted in this very special case. I would be delighted to visit his constituency to go go Bletchley park. One of my wife’s family worked there during the War, and speaks incredibly highly about what Alan Turing was like and what he was like to work with.

“Historians can argue the degree, but there is no doubt the work that was done in his constituency was absolutely vital in winning the War.”

Turing was prosecuted for gross indecency in 1952, after having a relationship with another man. The mathematical genius and codebreaker was the effective inventor of the modern computer and a key driver behind the victory over the Nazis.

He killed himself in 1954, two years after being sentenced to chemical castration for his homosexuality.

In 2009, after a campaign led by Richard Dawkins, Stephen Fry and Peter Tatchell and supported by PinkNews.co.uk, the then prime minister Gordon Brown issue an apology for Turing’s treatment on behalf of the British government.

A bill to pardon Turing passed its third reading in the Lords in October. It sought to grant a statutory pardon to Turing. However, it stalled in the House of Commons because of an objection by Tory MP Christopher Chope.

An earlier campaign to grant Turing a pardon was rejected by the Government as Turing was “properly convicted of what at the time was a criminal offence”, Justice Minister Lord McNally said, though it “now seems both cruel and absurd”.