Sweden has decided to drop the rape investigation into Wikileaks founder Julian Assange.
Top prosecutor Marianne Ny said his arrest warrant was being revoked as it was impossible to serve him notice.
Mr Assange, 45, has lived in the Ecuadorean embassy in London since 2012. He fears extradition to Sweden would lead to extradition to the US where he is wanted over leaks.
Ecuador has called on the UK to allow him safe passage out of the country.
However, police in London said they would still be obliged to arrest him if he left.
The Metropolitan Police Service (MPS) said Mr Assange still faced the lesser charge of failing to surrender to a court, an offence punishable by up to a year in prison or a fine.
But the UK has not commented on whether it has received an extradition request from the US, where Mr Assange could face trial over the leaking of hundreds of thousands of secret US military and diplomatic documents.
Mr Assange's Swedish lawyer, Per Samuelson, said the prosecutor's decision on Friday represented "a total victory" for his client.
But the Wikileaks founder responded angrily in a tweet: "Detained for 7 years without charge... while my children grew up and my name was slandered. I do not forgive or forget."
The plaintiff in the rape case was "shocked" by the decision, her lawyer said, and maintained her accusations against Mr Assange, Agence France-Presse reported.
The decision coincided with the release by Wikileaks of another tranche of documents about the CIA's technical capabilities.
Why has the case been dropped?
At a press briefing on Friday, Ms Ny said that by remaining in the embassy in London Mr Assange had evaded the exercise of the European Arrest Warrant (EAW) that would have seen him extradited to Sweden.
She said that under Swedish law a criminal investigation needed to be conducted "as quickly as possible".
Sweden did not expect Ecuador's co-operation in formally notifying Mr Assange of the allegations against him, a necessary step in proceeding with the case, she added.
But she said: "If he were to return to Sweden before the statute of limitation on this case expires in August 2020, the preliminary investigation could be resumed."
She said it was "regrettable we have not been able to carry out the investigation", and added: "We are not making any pronouncement about guilt."
What does Ecuador say?
A source at the Ecuadorean foreign ministry told the Press Association that Ecuador had "fully co-operated with the Swedish justice system".
The source criticised the Swedish prosecutor for "unnecessary delays" in the case but welcomed the latest decision.
The source added: "Ecuador will now be intensifying its diplomatic efforts with the UK so that Julian Assange can gain safe passage in order to enjoy his asylum in Ecuador."
How did Mr Assange end up where he is?
The rape allegation followed a Wikileaks conference in Stockholm in 2010. Mr Assange always denied the allegations against him, saying sex was consensual.
He also said the case was politically motivated, as it followed massive Wikileaks dumps of secret US military reports that year.
Later that year he was arrested in London after Sweden issued an international arrest warrant against him.
Then, in June 2012, after exhausting legal avenues to prevent his extradition, Mr Assange sought refuge in the Ecuadorean embassy, where he remains to this day.
What will happen to Mr Assange now?
After the news was announced on Friday, Wikileaks tweeted that the "focus now moves to the UK", but Mr Assange's fate still seems unclear.
The MPS issued a statement saying that its actions had been based on a response to a "European Arrest Warrant for an extremely serious offence".
It went on: "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 offence. The MPS will provide a level of resourcing which is proportionate to that offence."
The MPS said it would "not comment further on the operational plan".
Last month, Mr Samuelson filed a new motion calling for his client's arrest warrant to be lifted.
He cited a comment by new US Attorney General Jeff Sessions that the arrest of Mr Assange would be "a priority".
Mr Samuelson told Agence France-Presse: "This implies that we can now demonstrate that the US has a will to take action... this is why we ask for the arrest warrant to be cancelled."