Mr McKinnon, 46, who admits accessing US government computers but claims he was looking for evidence of UFOs, has been fighting extradition since 2002.
The home secretary told MPs there was no doubt Mr McKinnon was “seriously ill” and the extradition warrant against him should be withdrawn.
Mrs May said the sole issue she had to consider was his human rights.
Mrs May said: “After careful consideration of all of the relevant material I have concluded that Mr McKinnon’s extradition would give rise to such a high risk of him ending his life that a decision to extradite would be incompatible with Mr McKinnon’s human rights. I have therefore withdrawn the extradition order against Mr McKinnon.”
Mrs May also said measures would be taken to enable a UK court to decide whether a person should stand trial in the UK or abroad – a so-called forum bar.
It would be designed to ensure extradition cases did not fall foul of “delays and satellite litigation”, she said.
Mr McKinnon, from Wood Green, north London,who has been diagnosed with Asperger’s Syndrome, faced 60 years in jail if convicted in the US.
Mr McKinnon’s mother Janis Sharp was delighted with the decision, saying: “Thank you Theresa May from the bottom of my heart – I always knew you had the strength and courage to do the right thing.”
His MP, David Burrowes, who had threatened to resign as a parliamentary aide if Mr McKinnon was extradited, welcomed the decision.
Mr Burrowes tweeted: “Compassion and pre-election promises delivered today.”
BBC legal correspondent Clive Coleman said it was a dramatic decision – the first time a home secretary had stepped in to block an extradition under the current treaty with the US.
Shami Chakrabarti, director of civil rights group Liberty, said: “This is a great day for rights, freedoms and justice in the United Kingdom.
“The home secretary has spared this vulnerable man the cruelty of being sent to the US and accepted Liberty’s long-standing argument for change to our rotten extradition laws.”
Mark Lever, chief executive of the National Autistic Society, said he was “delighted that the years of waiting are finally over for Gary and his family”.
Mayor of London Boris Johnson said: “At last justice and the well-being of Mr McKinnon have prevailed. I have long supported Gary’s right to be tried here in the UK.
US authorities have described the Glasgow-born hacker’s actions as the “biggest military computer hack of all time” and have demanded he face justice in America.
They insisted his hacking was “intentional and calculated to influence and affect the US government by intimidation and coercion”.
The Americans said his actions caused $800,000 (£487,000) worth of damage to military computer systems.
Mr McKinnon has previously lost appeals in the High Court and the House of Lords against his extradition, but two years ago a High Court judge ruled Mr McKinnon would be at risk of suicide if sent away.
Earlier this year Mrs May put the decision on hold to allow Home Office appointed psychiatrists to conduct an assessment.
They also concluded that Mr McKinnon would be likely to take his own life if he was sent to face trial in the US.
Mr McKinnon was arrested in 2002 and again in 2005 before an order for his extradition was made in July 2006 under the 2003 Extradition Act.
Before Mrs May’s announcement, Ms Sharp said her son had lived a “zombified life” for the past decade, which had “destroyed him”.
- Gary McKinnon medical report offers hope against US extradition (guardian.co.uk)
- Gary McKinnon ‘hopeful’ that Home Secretary Theresa May will halt his extradition (independent.co.uk)
- Gary McKinnon’s mother: 10-year extradition fight like mental torture (telegraph.co.uk)
- Gary McKinnon extradition blocked by UK government (techradar.com)
- Hacker Gary McKinnon Avoids Extradition To United States (forbes.com)
- UK Home Secretary blocks Pentagon hacker Gary McKinnon’s US extradition (thenextweb.com)
- Reprieve for Gary McKinnon as Theresa May defies US extradition demands (standard.co.uk)
- UK will not extradite hacker McKinnon to U.S. because of health concerns (news.blogs.cnn.com)
- Theresa May has made the right decision on Gary McKinnon, but there are wider implications (blogs.telegraph.co.uk)
- Tory MP threatens to quit if Gary McKinnon is handed to US (theweek.co.uk)