STOCKHOLM/LONDON (Reuters) - WikiLeaks founder Julian Assange has been subject to ‘arbitrary detention’ during the 3-1/2 years he has spent in the Ecuadorian embassy in London to avoid a rape investigation in Sweden, a U.N. panel will rule on Friday.

Assange, who enraged the United States by publishing hundreds of thousands of secret U.S. diplomatic cables, appealed to the panel saying he was a political refugee whose rights had been infringed by being unable to take up asylum in Ecuador.

The former computer hacker denies allegations of a 2010 rape in Sweden, saying the charge is a ploy that would eventually take him to the United States where a criminal investigation into the activities of WikiLeaks is still open.

His leaks laid bare often highly critical U.S. appraisals of world leaders from Vladimir Putin to the Saudi royal family.

Britain said it had never arbitrarily detained Assange and that the Australian had voluntarily avoided arrest by jumping bail to flee to the embassy.

But the United Nations Working Group on Arbitrary Detention ruled in Assange’s favour, Sweden said.

“Should I prevail and the state parties be found to have acted unlawfully, I expect the immediate return of my passport and the termination of further attempts to arrest me,” Assange, 44, said in a short statement posted on Twitter.

He had said that if he lost the appeal then he would leave his cramped quarters at the embassy in the Knightsbridge area of London, though Britain said he would be arrested and extradited to Sweden as soon as he stepped outside.

Assange made international headlines in early 2010 when WikiLeaks published classified U.S. military video showing a 2007 attack by Apache helicopters that killed a dozen people in Baghdad, including two Reuters news staff.

Later that year, the group released over 90,000 secret documents detailing the U.S.-led military campaign in Afghanistan, followed by almost 400,000 internal U.S. military reports detailing operations in Iraq.

More than 250,000 classified cables from U.S. embassies followed, then almost three million dating back to 1973.

WikiLeaks founder Julian Assange gestures during a news conference at the Ecuadorian embassy in central London, Britain, in this August 18, 2014 file photo. REUTERS/John Stillwell/pool/Files

POLITICAL REFUGEE?

In his submission to the U.N. working group, which is due to publish its findings on Friday, Assange argued that his time in the embassy constituted arbitrary detention.

“(The) working group has made the judgement that Assange has been arbitrarily detained in contravention of international commitments,” a spokeswoman for the Swedish Foreign Ministry said, confirming an earlier report by the BBC.

He said that he had been deprived of fundamental liberties including access to sunlight and fresh air, adequate medical facilities and legal and procedural security.

While the ruling may draw attention to Assange’s fate, it is unlikely to immediately affect the current investigations against him.

“We have been consistently clear that Mr Assange has never been arbitrarily detained by the U.K. but is, in fact, voluntarily avoiding lawful arrest by choosing to remain in the Ecuadorean embassy,” a British government spokeswoman said.

“An allegation of rape is still outstanding and a European Arrest Warrant in place, so the UK continues to have a legal obligation to extradite Mr Assange to Sweden,” she said.

Swedish prosecutors said the U.N. decision had no formal impact on the rape investigation under Swedish law. A U.S. Grand Jury investigation into WikiLeaks is ongoing.

White House spokesman Josh Earnest said it was unclear what the impact “a pronouncement from the United Nations would have on the situation”.

“But, you know, but he’s facing serious charges inside of Sweden. Sweden has asked the British for extradition, and ultimately those two countries will have to resolve the situation,” Earnest said.

STAY OR GO?

Britain, where Assange is wanted for jumping bail, has spent over 10 million pounds ($15 million) on keeping guards outside the embassy for over three years,

“There seems to me a real risk that if he left the embassy that he may expose himself to arrest or questioning,” said Philip Lynch, director of the International Service for Human Rights in Geneva, an NGO.

“A decision that effective confinement in the Ecuadorian embassy constitutes arbitrary detention – it doesn’t necessarily lead to the conclusion that the underlying arrest warrants and extradition requests are unlawful.”

Per Samuelson, one of Assange’s Swedish lawyers, said if the U.N. panel judged Assange’s time in the embassy to be custody, he should be released immediately.

“It is a very important body that would be then saying that Sweden’s actions are inconsistent with the European Convention on Human Rights. And it is international common practise to follow those decisions,” Samuelson told Reuters.

Since Assange’s confinement, WikiLeaks has continued to publish documents on topics such as the Trans-Pacific Partnership, one of the world’s biggest multinational trade deals.