Julian Assange, the founder of WikiLeaks, pleaded guilty on Wednesday to a felony charge of violating the U.S. Espionage Act, securing his freedom under a plea deal that saw its final act play out in a remote U.S. courtroom in Saipan in the Western Pacific.

He appeared in court wearing a black suit with his lawyer, Jennifer Robinson, and Kevin Rudd, the Australian ambassador to the United States. He stood briefly and offered his plea more than a decade after he obtained and published classified secret military and diplomatic documents in 2010, moving a convoluted case involving several countries and U.S. presidents closer to its conclusion.

After a few hours of proceedings, he boarded a plane for Australia, where arrived in the capital, Canberra, shortly before 8 p.m.

It was all part of an agreement allowing Mr. Assange to return to normal life after spending more than five years in British custody — most of it fighting extradition to the United States.

His family and lawyers documented his journey from London to Bangkok and on to Saipan, capital of the Northern Mariana Islands, a U.S. commonwealth, posting photos and videos online from a chartered jet. His defense team said that in the negotiations over his plea deal, Mr. Assange had refused to appear in a court on the U.S. mainland, and that he had not been allowed to fly commercial.

His wife, Stella, posted an urgent fund-raising appeal on the social media platform X, seeking help in covering the $520,000 cost of the flight, which she said would have to be repaid to the Australian government. She also wrote on X that watching a video of Mr. Assange entering the courtroom made her think of “how overloaded his senses must be, walking through the press scrum after years of sensory deprivation and the four walls of his high-security Belmarsh prison cell.”