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, and the decision does not mean that Mr. Assange is in the clear.
In Britain, he still faces an arrest warrant for failing to appear in court, and the London police said on Friday that they would arrest him 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.
As reporters thronged outside the embassy Friday morning, officials there said that they had no comment and were awaiting instructions from the Ministry of Foreign Affairs in Ecuador.
In a post on Twitter, WikiLeaks said that Britain had refused to confirm or deny whether it had received an extradition warrant for Mr. Assange.
“The first thing that needs to be done, presumably, is to secure guarantees from the British authorities that he will not be arrested on other grounds,” Melinda Taylor, one of Mr. Assange’s lawyers, told the Swedish news agency TT, the newspaper Dagens Nyheter reported.
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 it was “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.
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.
“Chief Prosecutor Marianne Ny has today decided to shut down the preliminary investigation regarding suspected rape involving Julian Assange,” the Swedish prosecutors’ office said in a statement.
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.