A letter sent from Alan Turing to his mathematician friend Norman Routledge shows the codebreaker's worries and "distress" ahead of pleading guilty to gross indecency in 1952.
An excerpt from the communication is printed on the website Letters of Note, citing a Turing biography by Andrew Hodges.
I've now got myself into the kind of trouble that I have always considered to be quite a possibility for me, though I have usually rated it at about 10:1 against.
I shall shortly be pleading guilty to a charge of sexual offences with a young man.
The story of how it all came to be found out is a long and fascinating one, which I shall have to make into a short story one day, but haven't the time to tell you now.
No doubt I shall emerge from it all a different man, but quite who I've not found out.
Glad you enjoyed broadcast. Jefferson certainly was rather disappointing though.
I'm afraid that the following syllogism may be used by some in the future.
– Letter from Alan Turing to Norman Routledge
Turing believes machines thinkTuring lies with menTherefore machines do not think
Yours in distress,
Alan Turing revealed he was gay to the authorities by falling for an "old police trick," New Statesman legal writer David Allen Green reports.
Reporting a theft to police in 1952, Turing was forced to fabricate details of the account to conceal his relationship with a man.
Asked to repeat the account a week later by police, Turing was unable to accurately remember some of those fabricated details, Allen Green writes.
On realising his lies had been exposed, the brilliant mathematician produced a five-page letter admitting untruths as well as describing graphic details of his homosexual relationship.
The statement was enough for police to convict Turing and arrest his partner.
Second World Warcode-breaker Alan Turing has been given a posthumous royal pardon for a 61-year-old conviction for homosexual activity.
Dr Turing, who was pivotal in breaking the Enigma code, arguably shortening the Second World War by at least two years, was chemically castrated following his conviction in 1952.
His conviction for "gross indecency" 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.
Dr Turing, who died aged 41 in 1954 and is often described as the father of modern computing, has been granted a pardon under the Royal Prerogative of Mercy by the Queen following a request from Justice Secretary Chris Grayling.
"Dr Alan Turing was an exceptional man with a brilliant mind," Mr Grayling said.
David Cameron has paid tribute to Alan Turing for his role in "saving Britain in World War Two" after the famous code-breaker was awarded a a posthumous royal pardon.
The Prime Minister said: "Alan Turing was a remarkable man who played a key role in saving this country in World War Two by cracking the German Enigma code.
"His action saved countless lives. He also left a remarkable national legacy through his substantial scientific achievements, often being referred to as the father of modern computing."
Dr Alan Turing died of cyanide poisoning and an inquest recorded a verdict of suicide, although his mother and others maintained his death was accidental.
There has been a long campaign to clear the mathematician's name, including a well-supported e- petition and private member's bill, along with support from leading scientists such as Sir Stephen Hawking.
The pardon under the Royal Prerogative of Mercy will come into effect today.
The Justice Secretary has the power to ask the Queen to grant a pardon under the Royal Prerogative of Mercy, for civilians convicted in England and Wales.
A pardon is only normally granted when the person is innocent of the offence and where a request has been made by someone with a vested interest such as a family member.
But on this occasion a pardon has been issued without either requirement being met.
Ed Miliband has spoken of his "delight" that Alan Turing has received a Royal Pardon.
Reacting to the news on Twitter, the Labour leader posted:
Alan Turing was a hero and an extraordinary academic - his work helped win World War II. I'm delighted he has received a Royal Pardon.
News of the royal pardon granted posthumously to Alan Turing has been applauded as a "just reward" for the code-breaker.
Iain Stewart, Conservative MP for Milton Keynes South, who was involved in the campaign to secure a royal pardon, said: "Alan Turing was an incredibly important figure in our history. He was the father of computer science and the originator of the dominant technology of the late 20th century."
Gay rights campaigner Peter Tatchell said that the granting of the royal pardon was "long overdue" and called for the same treatment to be given to others convicted in similar circumstances.
He said: "Singling out Turing just because he is famous is wrong. Unlike Alan, many thousands of ordinary gay and bisexual men who were convicted under the same law have never been offered a pardon and will never get one.
"An apology and pardon is due to another 50,000-plus men who were also convicted of consenting, victimless homosexual relationships during the 20th century."
The Cambridge mathematician Alan Turing who saved thousands of lives through his code breaking work in the Second World War, is expected to be given a parliamentary pardon.
Turing, who was prosecuted and convicted over his homosexuality in the 1950s, has already received a posthumous apology.
The MP for Milton Keynes South, Iain Stewart, says a pardon would be 'a final cleansing of the wrong' done to Turing, as Alistair Nelson reports.