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 prosecutors’ 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 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 the 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, where Mr. Assange sought asylum.
“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 on Friday, the deadline for prosecutors to respond to a court-ordered deadline in the case.
But 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,” Ms. Ny said at a news conference in Stockholm.
The investigation could be reopened, she said, if Mr. Assange returned to Sweden before August 2020, the time limit for prosecution specified by the statute of limitations.
Per Samuelsson, a lawyer for Mr. Assange, told the Swedish television network SVT that the decision was “a big victory” for his client. He described Mr. Assange as a free man, although he conceded that “the United States is chasing him.”
He added, “They have made that clear.”
WikiLeaks has generated global controversy by publishing confidential and damaging information from the United States and other countries. During the presidential campaign last year the site distributed 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. Most notably, 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 were to try to leave.
Mr. Assange and WikiLeaks, whose work he appears to have closely overseen from the Ecuadorean Embassy, pose a legal and a political dilemma for the Trump administration.
During the presidential campaign, Mr. Trump repeatedly expressed glee and gratitude for WikiLeaks’ release of confidential emails from the Democratic National Committee and from the Clinton campaign. Even after American officials said the emails had been given to WikiLeaks by hackers working for Russian intelligence, Mr. Trump read them aloud at rallies and declared, “I love WikiLeaks!”
But the Justice Department has been considering the possibility of charging Mr. Assange. Attorney General Jeff Sessions suggested last month that arresting Mr. Assange was “a priority” for a crackdown on leaks. In addition, Mike Pompeo, the C.I.A. director, has said that WikiLeaks operated like “a hostile intelligence service” and that Mr. Assange was “a fraud.”
Asked in a recent interview with The Associated Press whether he still supported Mr. Assange, Mr. Trump equivocated: “I don’t support or unsupport. It was just information,” he said, referring to hacked emails WikiLeaks published. Of the attorney general’s plan to have Mr. Assange arrested, the president said, “I am not involved in that decision, but if Jeff Sessions wants to do it, it’s O.K. with me.”
As a legal matter, whether to charge Mr. Assange or others associated with WikiLeaks is a conundrum dating from 2010, when the Obama-era Justice Department began presenting evidence to a grand jury in Alexandria, Va.
Ultimately, no charges were brought, at least partly because it proved difficult to distinguish what WikiLeaks had done with classified information from what The New York Times and many other mainstream news organizations do.
Most news organizations that cover national security and foreign affairs regularly publish information from sources that is considered classified by the United States government. By long-established tradition, however, only the government officials who provide such information have been prosecuted, not the journalists who publish it.
Mr. Assange has stated that he would be willing to be extradited to the United States if Chelsea Manning, the Army intelligence analyst who assisted him in releasing classified documents, were released from prison, but he offered a caveat in January. “I’ve always been willing to go to the United States,” he said at an online news conference, “provided my rights are respected.”
Ms. Manning was convicted and sentenced to an unprecedented 35-year prison term for disclosing archives of secret files to WikiLeaks, but Mr. Obama commuted her sentence and she was released early from prison on Wednesday.