STOCKHOLM — Prosecutors in Sweden said on Friday that they would drop their investigation into Julian Assange, the WikiLeaks founder who sought refuge in the Ecuadorean Embassy in London five years ago after the authorities in Stockholm opened a preliminary rape inquiry against him.
With a legal cloud hanging over him, Mr. Assange, 45, an Australian, had refused to go to Sweden for fear of being extradited to the United States, but the decision does not mean that Mr. Assange is in the clear.
In Britain, he still faces a warrant for failing to appear in court, and the London police said on Friday that they would arrest Mr. Assange, who has consistently maintained his innocence, if he tried to leave the embassy.
Moreover, the Justice Department in Washington was reconsidering last month whether to charge Mr. Assange for his role in the disclosure of highly classified information. The British government would not say on Friday whether it had received an extradition request from the United States.
As reporters thronged outside the embassy Friday morning, Fidel Narváez, a spokesman, said Ecuadorean officials in London would have no comment and were awaiting instructions from the Ministry of Foreign Affairs in Ecuador.
The Metropolitan Police in London said, however, that they still planned to carry out a warrant issued after Mr. Assange failed to surrender in June 2012, and that they would be “obliged” to execute the warrant if he were to leave the Ecuadorean Embassy.
“Now that the situation has changed and the Swedish authorities have discontinued their investigation into that matter, Mr. Assange remains wanted for a much less serious offense,” the police said in a statement.
Marianne Ny, the chief prosecutor in Sweden, made clear that the authorities were not pronouncing Mr. Assange innocent. “I can conclude, based on the evidence, that probable cause for this crime still exists,” she said.
Instead, she said, prosecutors felt that they had no choice but to abandon the investigation because they had concluded that Ecuador would not cooperate, and because all other possibilities had been exhausted. “My assessment is that the transfer cannot be executed in the foreseeable future,” she said at a news conference in Stockholm.
The investigation could be reopened, she said, if Mr. Assange returned to Sweden before the statute of limitations elapsed in August 2020.
WikiLeaks has generated global controversy by publishing confidential and damaging information from the United States and other countries.
During the presidential campaign in the United States, WikiLeaks came under criticism for distributing hacked emails from the Democratic National Committee.
Mr. Assange, a mercurial figure, has acknowledged that the release of the documents had been timed to induce maximum harm to the prospects of Hillary Clinton.
Mr. Assange has said that he met his accuser in August 2010 during a trip to Sweden. He said he was forced to rely on the hospitality of others after his bank cards were blocked because of the United States government’s aggressive stance against WikiLeaks.
In a statement detailing his relationship with his accuser, he said that the woman had expressed a clear desire “to have sexual intercourse with me,” and that the two had parted amicably after having sex several times.
Mr. Assange says that he has been denied due process during his time at the embassy, and endured “cruel, inhumane and degrading treatment.” He has repeatedly cited a determination by the United Nations Working Group on Arbitrary Detention that the Swedish and British governments had “arbitrarily detained” him since 2010.
In a recent letter to the Swedish government, Ecuador criticized the lack of progress in the investigation, expressing dismay over its sluggish pace despite the fact that Swedish officials had questioned Mr. Assange at the embassy at the end of 2016.
The long-running case against Mr. Assange had suffered several setbacks. In August 2015, prosecutors dropped their investigation into two possible charges — one of sexual molestation and one of unlawful coercion — because they had been unable to question Mr. Assange.
In October 2015, the London police announced they were ending round-the-clock surveillance of Mr. Assange, citing the strain on resources. Until then, the police had been keeping a 24-hour-watch outside the embassy in the upscale Knightsbridge area, ready to arrest him if he tried to leave.
The Justice Department has been considering whether to charge Mr. Assange for his role in disclosing highly classified information that the American government believes has undermined national security and diplomatic relations.
The issue gained added impetus in April after Attorney General Jeff Sessions said arresting Mr. Assange was a priority for the Justice Department.
But it is not clear whether prosecutors will be able to pursue the most serious charges of espionage against Mr. Assange for his role years ago in disclosing classified documents, along with the Army intelligence analyst Chelsea Manning.
Ms. Manning was convicted and sent to prison, but President Barack Obama commuted her sentence and she was released early from prison on Wednesday after having been sentenced to an unprecedented 35-year prison term for disclosing archives of secret files to WikiLeaks.