WikiLeaks founder Julian Assange cannot be extradited to the US, a judge at the Old Bailey has said.
Judge Vanessa Baraitser said she had refused his extradition because of fears that he could take his own life.
The US government said it would appeal against the decision.
Assange’s supporters were overjoyed at the decision not to extradite him but were unhappy that the ruling was made on health grounds.
US prosecutors indicted Assange on 17 espionage charges and one charge of computer misuse over WikiLeaks’ publication of leaked military and diplomatic documents in 2010.
The 49-year-old Australian activist was re-arrested in September over the charges, which carry a maximum sentence of 175 years in prison.
The indictment claims he conspired with army intelligence analyst Chelsea Manning to crack a scrambled password to a classified US defence department computer.
The charges also offer further details of alleged hacking plotters that Assange and his WikiLeaks colleagues are said to have recruited.
Assange denies plotting with Manning to crack an encrypted password on US Department of Defence computers and claims there is no evidence anyone’s safety was put at risk.
He appeared at the Old Bailey on Monday where Judge Baraitser delivered her judgment.
His lawyers argued that he was acting as a journalist and is entitled to First Amendment protections of freedom of speech for publishing leaked documents that exposed US military wrongdoing in Iraq and Afghanistan.
But the judge rejected these claims, saying his conduct “would therefore amount to offences in this jurisdiction that would not be protected by his right to freedom of speech.”
She added that Assange suffered from clinical depression that would be exacerbated by the isolation he would likely face in US prison, adding he had the “intellect and determination” to circumvent any suicide prevention measures the authorities could take.
WikiLeaks editor-in-chief Kristinn Hrafnsson described the case as “an historic, large-scale attack on freedom of speech”.
Assange’s fiancee, Stella Moris, with whom he has two young sons, was at the Old Bailey for the hearing.
Reading a statement outside court following the judgment, Ms Moris said: “Today is a victory for Julian. Today’s victory is a first step towards justice in this case.”
The US non-profit Freedom of the Press Foundation tweeted: “The case against Julian Assange is the most dangerous threat to US press freedom in decades. This is a huge relief to anyone who cares about the rights of journalists.
“The extradition request was not decided on press freedom grounds; rather, the judge essentially ruled the US prison system was too repressive to extradite. However, the result will protect journalists everywhere.”
Fidel Narvaez, who worked at the Ecuadorean embassy for the majority of the time Assange lived there, said: “Be aware that freedom of expression is still under attack – if it was not for Julian’s health condition, he would be extradited.”
Michelle Stanistreet, general secretary of the National Union of Journalists (NUJ), said the judgment was “troubling” and left it open to future US governments to take a similar approach.
Meanwhile, former shadow home secretary Diane Abbott said the decision not to allow the extradition was an “excellent ruling by the British judge”.
“Congratulations to all the dogged campaigners on Assange’s behalf,” she tweeted.
His mother Christine urged the US not to appeal against the ruling, saying her son had “suffered enough”.
A bail hearing is expected shortly.
Analysis: It’s a mixed outcome for those who had campaigned against Assange’s extradition
By Dominic Waghorn, diplomatic editor
For much of the judge’s ruling as it was read out in court, it did not look good for Julian Assange.
US prosecutors, she said, met the tests for him to be extradited. She had to decide whether or not the alleged offences he is wanted for in America could lead to trial in Britain had he done them here. She seemed to think they could.
But it was the reputation of America’s supermax prison system that seems to have saved Assange from extradition.
Near total isolation would not be good for his mental health and the US would be incapable of preventing him from taking his life, she decided.
His lawyers say he is suffering from depression and has self-harmed and said there was a good chance he would end up in a supermax.
So it’s a mixed outcome for those who had campaigned against Assange’s extradition. On the one hand he stays here.
On the other if America had more humane jails there was plenty of reason to send him to there seemed to be the gist of the ruling.
The Assange case has been obscured by all sorts of distractions. The original sexual allegations brought against him by Sweden, his extraordinary self-imposed incarceration in the Ecuadorean embassy not to mention his eccentric, mercurial, volatile personality.
But at the heart of the case against him was the simple question, was he a publisher, a journalist, and a war crimes whistle-blower or a spy and a hacker.
The British judge decided Assange’s activity with Chelsea Manning “went beyond the mere encouragement of a journalist”. That will dishearten Assange supporters and campaigner for free speech and may encourage US prosecutors to continue their efforts to have him extradited.
They have two weeks now within which to appeal. The judge’s decision spares Home Secretary Priti Patel from a politically delicate decision at least for now. She will have the final say in Assange’s extradition should an appeal succeed.