Swedish prosecutors have dropped their preliminary investigation into an allegation of rape against the WikiLeaks founder, Julian Assange, bringing an end to a seven-year legal standoff.

The decision was taken after prosecutors concluded that “at this point, all possibilities to conduct the investigation are exhausted”, Sweden’s director of public prosecutions, Marianne Ny, said on Friday.

“In order to proceed with the case, Julian Assange would have to be formally notified of the criminal suspicions against him. We cannot expect to receive assistance from Ecuador regarding this. Therefore the investigation is discontinued.

“If he, at a later date, makes himself available, I will be able to decide to resume the investigation immediately.”

The WikiLeaks founder sought asylum in Ecuador’s embassy in London in 2012 after losing court battles to avoid extradition to Sweden over the claims, which he denies.

Separate allegations of sexual assault, made by a second Swedish woman, were dropped by Swedish authorities in 2015 after the statute of limitations expired.

Shortly after the announcement on Friday morning, an image of Assange smiling was posted to his Twitter account.

Later he tweeted again: “Detained for 7 years without charge while my children grew up and my name was slandered. I do not forgive or forget.”

However, a lawyer representing the woman who made the allegation of rape described the decision as a “scandal”.

“It is a scandal that a suspected rapist can escape justice and thereby avoid the courts,” Elisabeth Massi Fritz told Agence France-Presse in an email. “My client is shocked and no decision to [end the case] can make her change [her view] that Assange exposed her to rape.”

With the threat of extradition to Sweden removed, the 45-year-old Australian could potentially opt to leave the embassy.

However, Assange’s lawyers have repeatedly said he will not do so without assurances that he willnot face extradition to the US over possible espionage charges linked to WikiLeaks’ publishing activities – the basis on which Ecuador granted him asylum.

The Metropolitan police in London said Assange would also face immediate arrest for breaching his bail conditions; a warrant was issued when he failed to attend a magistrates court after entering the embassy.

“The Metropolitan police service is obliged to execute that warrant should he leave the embassy,” the statement said.

It added: “Whilst Mr Assange was wanted on a European arrest warrant (EAW) for an extremely serious offence, the MPS response reflected the serious nature of that crime. 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.”

Per Samuelson, Assange’s Swedish lawyer, told reporters the decision represented a total victory.

“This is one of the happiest days of my legal career. The decision was taken because he was interrogated in November 2016 and could give a good explanation of what happened … This is obviously about consensual sex between two adults.”

Ecuador’s foreign minister, Guillaume Long, also welcomed the decision, adding that he “regrets that the Swedish prosecutor delayed more than four years in carrying out this interview. Given that the European arrest warrant no longer holds, 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.”

But Claes Borgström, the lawyer who originally represented Assange’s two accusers but is no longer involved in the case, said he found the decision regretful. He told the Guardian: “I understand why the prosecutors have dropped the case now. Such a long time has passed. But I regret that Julian Assange was not brought to the Swedish court of law to answer the allegations against him.

“All the time since he left Sweden it has been in his hands. He decided to avoid the arms of justice. He didn’t want to come to court. He didn’t want to answer the allegations, so he decided to escape.”

The EAW against Assange was formally withdrawn at Westminster magistrates court on Friday morning, the Crown Prosecution Service confirmed. The UK Home Office said the decision to drop the rape investigation was a matter for the Swedish authorities, and not one in which the British government had any involvement.

Reuters reported in March that a long-running US grand jury investigation into WikiLeaks had been expanded to include recent leaks of CIA documents, a move that Assange’s lawyers said strengthened the grounds for his asylum claim.

Why has the rape inquiry into Julian Assange been dropped?

Sweden's director of prosecutions Marianne Ny said that the possibilities for investigating the allegations, which date from 2010, had been exhausted and that it was therefore necessary under Swedish law to discontinue the inquiry. But, she said, it could be reopened if Assange returns to Sweden before the statute of limitations ends in 2020. Another allegation of sexual assault made by a second Swedish woman was dropped by Swedish authorities in 2015 after the statute of limitations expired. The UK government said on Friday it had no involvement in Sweden’s decision to drop the investigation.

Friday’s announcement in Sweden followed the Swedish government receiving a letter from the government of Ecuador which accused the prosecutor of “serious failure”, including a “lack of initiative” to complete inquiries.

Public declarations such as this constituted an “obvious risk” for Assange, the letter said.

The US attorney general, Jeff Sessions, said last month that arresting Assange was a priority. There are no charges against him, although media reports have suggested the US justice department is considering how to bring them.

“We’ve already begun to step up our efforts and whenever a case can be made, we will seek to put some people in jail,” Sessions said.

Asked at a Conservative party campaign event in Edinburgh if the UK would now support a request to extradite Assange to the US, Theresa May said: “We look at extradition requests on a case-by-case basis.”

The prime minister added: “In relation to Julian Assange, any decision that is taken about UK action in relation to him were he to leave the Ecuadorian embassy would be an operational matter for the police.”