Alan Turing was a wartime hero whose later life was overshadowed by a conviction for homosexual activity, which was later considered unjust and discriminatory.

Often considered to be the father of computer science, Turing played a pivotal role in breaking the Enigma code and his legacy has a lasting impact on the way we live today.

Born on June 23 1912, Turing studied mathematics at King’s College, University of Cambridge, gaining a first-class honours degree in 1934. He was elected a Fellow of the College.

In 1936 his work On Computable Numbers is seen as giving birth to the idea of how computers could operate.

Alan Turing notebook
The notebook of Enigma code-breaker Alan Turing, loaned to Bletchley Park, which played a major part in breaking codes in the Second World War (Chris Radburn/PA)

His “Turing test” also examined the behaviour necessary for a machine to be considered intelligent – the foundation for artificial intelligence.

Perhaps Turing’s best-known achievement was his role in cracking the Enigma code.

It has been said this helped to shorten the length of the Second World War by at least two years – saving millions of lives.

The Enigma enciphering machine, adopted by the German armed forces to send messages securely, was believed to be unbreakable as the cipher changed continuously.

Turing was part of an Enigma research section, which worked in the stable yard at Bletchley Park.

The first wartime Enigma messages were broken in January 1940 and Enigma traffic continued to be broken routinely at Bletchley Park for the remainder of the war.

Turing was later convicted of gross indecency for his relationship with a man.

His conviction led to the removal of his security clearance and meant he was no longer able to work for Government Communications Headquarters (GCHQ) where he had continued to work following service at Bletchley Park during the war.

He was chemically castrated following his conviction in 1952 and he died aged 41 in 1954.

Turing died of cyanide poisoning and an inquest recorded a verdict of suicide, although his mother and others maintained his death was accidental.

He was later given a posthumous royal pardon, following a request from the then Justice Secretary Chris Grayling.

“Dr Alan Turing was an exceptional man with a brilliant mind,” Mr Grayling said previously.

“His brilliance was put into practice at Bletchley Park during the Second World War, where he was pivotal to breaking the Enigma code, helping to end the war and save thousands of lives.

“His later life was overshadowed by his conviction for homosexual activity, a sentence we would now consider unjust and discriminatory and which has now been repealed.

“Dr Turing deserves to be remembered and recognised for his fantastic contribution to the war effort and his legacy to science.

“A pardon from the Queen is a fitting tribute to an exceptional man.”

In September 2009, then-prime minister Gordon Brown apologised to Turing for prosecuting him as a homosexual, after a petition calling for such a move.

An e-petition, Grant a pardon to Alan Turing, had previously received 37,404 signatures.