STOCKHOLM/LONDON Swedish prosecutors dropped an investigation of WikiLeaks founder Julian Assange on Friday over a rape allegation, but British police said he would still be arrested if he left the Ecuadorean embassy in London where he has been holed up for five years.

Assange, 45, took refuge in the embassy in June 2012 to avoid extradition to Sweden after two women made rape and sexual molestation allegations against him, which he denies.

He feared Sweden would hand him over to the United States to face prosecution over WikiLeaks' publication of swathes of classified military and diplomatic documents in one of the largest information leaks in U.S. history.

Appearing on the balcony of the embassy after the Swedish announcement, Assange said he was ready to talk to Britain "about what is the best way forward" and with the U.S. Department of Justice, but also defended his right to stay put.

"The road is far from over. The war, the proper war is just commencing," he told supporters and media after raising a clenched fist in a gesture of victory.

Police in London said they were still obliged to arrest Assange if he left the embassy for skipping bail. They said this was a much less serious offence than rape, but he could still face up to a year in jail if convicted.

Assange is a cyber hero to some for exposing government abuses of power and championing free speech, but to others he is a criminal who has undermined the security of the West.

The former computer hacker enraged Washington by publishing hundreds of thousands of secret U.S. diplomatic cables that laid bare often highly critical U.S. appraisals of world leaders from Russian President Vladimir Putin to the Saudi royal family.

Earlier on Friday Swedish Chief Prosecutor Marianne Ny said the rape investigation could not proceed due to legal obstacles.

"We are not making a statement about his guilt," Ny said, adding that the investigation could be reopened if Assange came to Sweden before the statute of limitations deadline for the rape allegation in 2020.

Assange always denied the rape allegations and said they were a ploy to get him whisked off to the United States.

WANTED BY WASHINGTON

In January, Assange said he stood by an offer to go to the United States providing his rights were upheld and if former military intelligence analyst Chelsea Manning, who was responsible for a 2010 leak of classified materials to Assange's anti-secrecy group, was freed.

Manning was released on Wednesday after spending seven years in a U.S. military prison for passing the documents to WikiLeaks.

British Prime Minister Theresa May said on Friday it would be "an operational matter for the police" to decide whether to arrest Assange if he left the embassy.

Asked if she would support Britain extraditing Assange to the United States, she said: "We look at extradition requests when we receive them on a case-by-case basis."

While Assange may still not be able to leave the embassy in the upmarket Knightsbridge area of London, the prosecutor's decision to stop the investigation into allegations of rape brings to an end a seven-year stand-off with Sweden.

The Ecuadorean government welcomed the decision and in a statement called on Britain to grant Assange safe passage to Ecuador. Foreign Minister Guillaume Long said Assange was welcome to stay in the embassy if this was not granted.

"As long as we fear that this is a case of political persecution ... as long as we fear for Mr. Assange's integrity and human rights, we will continue with our policy of offering him asylum," Long said in a telephone interview.

He said that recent statements by U.S. President Donald Trump and Attorney General Jeff Sessions indicating that United States authorities would seek to arrest Assange were a sign that he still faces persecution outside Britain.

"HOSTILE INTELLIGENCE SERVICE"

Last month CIA Director Mike Pompeo called WikiLeaks a "hostile intelligence service", and Sessions, responding to a question about Assange, said the Trump administration was stepping up its efforts against all leaks of sensitive information.

"Whenever a case can be made, we will seek to put some people in jail," Sessions said.

During last year's U.S. presidential election campaign, WikiLeaks published emails from Hillary Clinton's staff and the Democratic National Committee which some believe helped to lose her the election to Trump. U.S. intelligence agencies have concluded the Russian government hacked the emails as part of an effort by Moscow to tilt the election in Trump's favour.

The Assange case has raised questions about the Swedish justice system, with a United Nations panel saying Assange had been subject to "arbitrary detention".

Prosecutors have been accused of vacillating, first dropping the preliminary investigation and then re-opening it and of dragging their heels over questioning Assange.

Prosecutors first interviewed Assange in November last year in the Ecuadorean embassy. They were not allowed to question him directly but only through an Ecuadorean prosecutor.

Assange's lawyer, Per Samuelson, hailed Sweden's decision to drop the investigation as "a total victory for us".

(Additional reporting by Alexandra Valencia, Brian Ellsworth, Johannes Hellstrom, Johan Ahlander, Niklas Pollard, Olof Swahnberg, Costas Pitas, Wiliam Schomberg and Guy Faulconbridge; Editing by Gareth Jones and Frances Kerry)