WikiLeaks founder Julian Assange, who has been holed up in the Ecuadorian embassy in London since 2012 to avoid a rape investigation, was detained arbitrarily in contravention of international law, 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.

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

READ: Britain refuses to grant Assange safe passage for medical check

READ: Sweden requests permission from Ecuador to quiz Assange

But the U.N. 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.

The decision in his favour marks the latest twist in a tumultuous journey for Assange since he incensed Washington with his leaks that laid bare often highly critical U.S. appraisals of world leaders from Vladimir Putin to the Saudi royal family.


STEPPING OUT?

While the ruling - which will be published on Friday - 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.

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 impact "a pronouncement from the United Nations would have on the situation."

"But, you know, but he's facing serious charges inside of Sweden," Earnest said.

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

Since he sought refuge in the small embassy, British media have reported Assange has suffered from an irregular heartbeat, a chronic cough and high blood pressure.