SYDNEY/WASHINGTON (Reuters) - WikiLeaks founder Julian Assange is due to plead guilty on Wednesday to violating U.S. espionage law, in a deal that will end his imprisonment in Britain and allow him to return home to Australia, ending a 14-year legal odyssey.

Assange, 52, has agreed to plead guilty to a single criminal count of conspiring to obtain and disclose classified U.S. national defense documents, according to filings in the U.S. District Court for the Northern Mariana Islands.

The deal marks the end of a legal saga in which Assange spent years in a British high-security jail and in the Ecuadorean embassy in London and fought allegations of sex crimes in Sweden, while battling extradition to the U.S., where he faced 18 criminal charges.

Viewed as a villain by the U.S. government for potentially putting classified government sources at risk, he has been hailed as a hero by free press advocates for exposing wrongdoing and alleged war crimes.

On Wednesday, he is due to be sentenced to 62 months of time already served at a hearing in Saipan in the Northern Mariana Islands, at 9 a.m. local time (2300 GMT Tuesday). The U.S. territory in the Pacific was chosen due to Assange's opposition to travelling to the mainland U.S. and for its proximity to Australia, prosecutors said.

Assange left Belmarsh prison in the UK on Monday before being bailed by the UK High Court and boarding a flight that afternoon, Wikileaks said in a statement posted on social media platform X.

"This is the result of a global campaign that spanned grass-roots organisers, press freedom campaigners, legislators and leaders from across the political spectrum, all the way to the United Nations," the statement said.

A video posted on X by Wikileaks showed Assange dressed in a blue shirt and jeans signing a document before boarding a private jet with the markings of charter firm VistaJet.

The only VistaJet plane that left Stansted on Monday afternoon landed in Bangkok on Tuesday afternoon, en-route to Saipan, according to FlightRadar24 data.

Assange will return to Australia after the hearing, the Wikileaks statement said.

"Julian is free!!!!" his wife, Stella Assange, said in a post on X.

"Words cannot express our immense gratitude to YOU - yes YOU, who have all mobilised for years and years to make this come true."

A spokesperson for Assange in Australia declined to comment on his flight plans. VistaJet did not respond to a request for comment.

The Australian government, led by Prime Minister Anthony Albanese, has been pressing for Assange's release but declined to comment on the legal proceedings as they were ongoing.

"Regardless of the views that people have about Mr. Assange (and) his activities, the case has dragged on for too long," Albanese said in the country's parliament.

"There is nothing to be gained by his continued incarceration and we want him brought home to Australia."

A lawyer for Assange did not respond to a request for comment.

HISTORIC CHARGES

WikiLeaks in 2010 released hundreds of thousands of classified U.S. military documents on Washington's wars in Afghanistan and Iraq - the largest security breaches of their kind in U.S. military history - along with swaths of diplomatic cables.

Assange was indicted during former President Donald Trump's administration over WikiLeaks' mass release of secret U.S. documents, which were leaked by Chelsea Manning, a former U.S. military intelligence analyst who was also prosecuted under the Espionage Act.

The trove of more than 700,000 documents included diplomatic cables and battlefield accounts such as a 2007 video of a U.S. Apache helicopter firing at suspected insurgents in Iraq, killing a dozen people including two Reuters news staff. That video was released in 2010.

The charges against Assange sparked outrage among his many global supporters who have long argued that Assange as the publisher of Wikileaks should not face charges typically used against federal government employees who steal or leak information.

Many press freedom advocates have argued that criminally charging Assange represents a threat to free speech.

"While we welcome the end of his detention, the U.S.'s pursuit of Assange has set a harmful legal precedent by opening the way for journalists to be tried under the Espionage Act if they receive classified material from whistleblowers," said Jodie Ginsberg, CEO of the Committee to Protect Journalists.

LONG ODYSSEY

Assange was first arrested in Britain in 2010 on a European arrest warrant after Swedish authorities said they wanted to question him over sex-crime allegations that were later dropped. He fled to Ecuador's embassy, where he remained for seven years, to avoid extradition to Sweden.

He was dragged out of the embassy in 2019 and jailed for skipping bail. He has been in London's Belmarsh top security jail ever since, from where he has for almost five years been fighting extradition to the United States.

Those five years of confinement are similar to the sentence imposed on Reality Winner, an Air Force veteran and former intelligence contractor, who was sentenced to 63 months after she removed classified materials and mailed them to a news outlet.

Chelsea Manning was sentenced to 35 years, but President Barack Obama reduced the term to seven years, saying her sentence was disproportionate to those received by other leakers.    

While in Belmarsh Assange married his partner Stella with whom he had two children while he was stuck in the Ecuadorean embassy.

(Reporting by Sarah N. Lynch, Andrew Goudsward and Kanishka Singh in Washington, Michael Holden and Kate Holton in London, Lisa Barrington in Seoul and Alasdair Pal, Kirsty Needham and Renju Jose in Sydney; Editing by Scott Malone, Matthew Lewis and Sonali Paul)

By Alasdair Pal and Sarah N. Lynch