Swedish prosecutors are dropping their investigation into Wikileaks founder Julian Assange over rape allegations.

Assange has been sheltering in the Ecuadorian embassy in London since 2012 to avoid extradition.

But he will still be arrested if he leaves the embassy because he failed to surrender to a court in 2012.

Swedish prosecutors said on Friday they would drop a preliminary investigation into an allegation of rape against WikiLeaks founder Julian Assange on Friday, bringing to an end an epic seven-year legal stand-off.

However, he's not a free man just yet.

"Chief Prosecutor Marianne Ny has today decided to discontinue the preliminary investigation regarding suspected rape concerning Julian Assange," the prosecutors office said in a statement. It is being dropped because the investigators cannot proceed, rather than because the prosecutors reached any decision on whether or not Assange is guilty.

The investigation could be reopened if he revisits Sweden before August 2020.

Julian Assange responded to the initial news on Twitter by posting a photo of him smiling.

Assange, 45, has lived in the Ecuadorean Embassy in London since 2012, after taking refuge there to avoid extradition to Sweden over the allegation of rape, which he denies.

Assange has maintained that if he went to Sweden to answer questions about the allegations, he would then be extradited to the US for his political activities with Wikileaks.

The Wikileaks founder pictured on the balcony of the Ecuadorian Embassy in London. Peter Nichols/Reuters It's not immediately clear if or when Assange will try leave the embassy — Wikileaks did not immediately respond to a message from Business Insider seeking comment.

But the official Wikileaks account indicated in a tweet that the organisation is still concerned about a potential extradition to the US. It tweeted: "UK refuses to confirm or deny whether it has already received a US extradition warrant for Julian Assange. Focus now moves to UK."

The Metropolitan Police, meanwhile, has said that it will still arrest Assange if he tries to leave. A warrant was issued in 2012 because he failed to surrender to a court (instead taking refuge in the embassy). This warrant remains in force, even though the allegations are no longer being investigated.

"The Metropolitan Police Service is obliged to execute that warrant should he leave the Embassy," the law enforcement organisation said in a statement.

"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."

Failure to surrender is punishable with up to 12 months in prison, per the Crown Prosecution Service's website.

"In view of the fact that all prospects of pursuing the investigation are now exhausted, it appears that, in light of the views expressed by the Supreme Court in its assessment of the proportionality in this case, it is no longer proportionate to maintain the arrest of Julian Assange in his absence via a European Arrest Warrant," the prosecutors said in a statement.

"If Julian Assange were to return to Sweden before the statue of limitation for the crime elapses in August 2020 the preliminary investigation could however be reopened," Chief Prosecutor Marianne Ny said at a press conference on Friday.

Ny said that the decision to discontinue the investigation did not relate to the question of whether Assange was guilty or not, but rather because it was impossible to proceed with the investigation: "We don't make any statements on the issue of guilt."

Cost did not play a part in the decision to close the investigation, she said.

Wikileaks is fiercely controversial, and has repeatedly drawn the ire of the American government for its release of highly classified documents. These include internal memos from US embassies, and a "Collateral Murder" video which showed a US helicopter firing on journalists in Iraq.

In the run-up to the US presidential election last year, Wikileaks released emails and documents taken from the Democratic Party — dominating the news cycle with headlines unfavourable to establishment favourite Hillary Clinton. The US government has said the documents were stolen by Russian hackers, and deliberately released to undermine faith in the election and destabilise Clinton.

Assange's five years of self-imposed captivity have not been easy. He has suffered from health ailments, Wikileaks has said, but has not left to seek treatment for fear of being arrested. The relationship with his Ecuadorian hosts has been at time strained. Documents leaked to BuzzFeed detailed apparent concerns about his psychological health, and included photos of how a book case was thrown across his room in 2013.

This story is developing...