LONDON — A British judge upheld an arrest warrant for Julian Assange on Tuesday, a significant setback for him after five and a half years of evading the authorities by living in the Ecuadorean Embassy in London.
Before a packed London courtroom, Senior District Judge Emma Arbuthnot rejected the points made by Mr. Assange’s lawyer, stating that he was not a prisoner, and in fact could walk free at any time to meet his legal fate, and that his living conditions were nothing like those of a prison.
“He is a man who wants to impose his terms on the course of justice,” she said, and “he wants justice only when it’s in his favor.”
If the judge had voided the warrant, Mr. Assange, the founder of WikiLeaks, might have left the embassy, but that was far from certain. The United States and British governments have never publicly ruled out the existence of a secret request to extradite him to the United States, where he could face prosecution for publishing classified documents.
WikiLeaks released in 2010 a trove of government documents provided by Chelsea Manning, a United States Army analyst, which American officials said harmed national security.
In 2016, it published emails, hacked by Russian intelligence, that were damaging to Hillary Clinton’s presidential campaign. Mike Pompeo, the C.I.A. director, has said that WikiLeaks acts “like a hostile intelligence service.”
Attorney General Jeff Sessions said last year that arresting Mr. Assange was a priority for the Justice Department. But no charges against him have been made public, and it is not clear whether the department has prepared an indictment but kept it under seal.
Ecuador recently granted citizenship to Mr. Assange, 46, a native of Australia, but Britain rejected an Ecuadorean request to give him diplomatic immunity so that he could leave the embassy without fear of arrest.
Mr. Assange’s legal hurdles began in 2011, when Sweden requested that he be extradited there to face accusations that he had sexually assaulted two women. He said that the charges were politically motivated, that he would not get a fair trial there, and that Sweden might turn him over to the United States.
After the British courts rejected his bid to quash the extradition request, Ecuador granted him asylum and he took refuge in the embassy. In doing so, he jumped bail, which resulted in the British arrest warrant.
This week, news organizations reported that years ago, Swedish prosecutors considered giving up the sexual assault case, but their British counterparts urged them not to.
Last year, Swedish authorities did drop their investigation of Mr. Assange, along with the request to extradite him, and the arrest warrant is the only remaining legal issue that is publicly known.
His lawyers argued that the warrant, and his resulting self-imposed isolation, were not in the public interest. But Judge Arbuthnot disagreed, saying that his “failure to surrender has impeded the court of justice.”