WASHINGTON: WikiLeaks founder Julian Assange is due to plead guilty this week 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 long 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.

Assange is due to be sentenced to 62 months of time already served at a hearing on the island of Saipan at 9 a.m. local time on Wednesday (1900 EDT/2300 GMT on Tuesday). He is expected to return home after that hearing.

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

ALSO READ: Julian Assange: WikiLeaks’ controversial founder

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.

ALSO READ: Australian PM urges end to Assange’s incarceration

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.

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

ALSO READ: Julian Assange wins bid to appeal US extradition ruling: UK judges

WikiLeaks founder Julian Assange in final High Court bid for appeal against extradition