Travis King, the US soldier who fled from South to North Korea last year before being returned home, has been sentenced to one year of confinement and dishonourably discharged from the military.
He faced charges including desertion in July 2023 and assault of a non-commissioned officer.
But with time already served and credit for good behaviour, the 24-year-old Army private walked free, his legal team told the BBC.
At Friday's hearing at Fort Bliss, Texas, he pleaded guilty to five of the original 14 military charges that had been filed against him. The other counts were dismissed.
King joined the army in January 2021 and was in South Korea as part of a unit rotation when he crossed into North Korea.
At the hearing, King told military judge Lt Col Rick Mathew that he had decided to flee the US Army because he was “dissatisfied” with work and had been thinking about leaving for about a year before he bolted into North Korea.
“I wanted to desert from the US Army and never come back,” King said, according to reporters inside the courtroom.
He also said he had been diagnosed with mental health conditions, though he maintained he was fit to stand trial and understood the charges.
King's lawyer, Franklin Rosenblatt, said in a statement that his client accepts full responsibility for what happened and added that King "faced significant challenges in his life, including a difficult upbringing, exposure to criminal environments, and struggles with mental health".
"All these factors have compounded the hardships he faced in the military," Mr Rosenblatt said.
King illegally crossed into North Korea while on a civilian tour of the village of Panmunjom, located on the heavily guarded Demilitarised Zone (DMZ) between North and South Korea.
He joined the civilian tour after he was released from a South Korean prison where he had served nearly two months on charges that he assaulted two people and kicked a police car.
After his release, he was taken to the airport so he could return to the Fort Bliss base to face disciplinary action. But instead of getting on the plane, King joined the civilian tour and ultimately bolted into North Korea, where he was detained by local authorities.
At the time, North Korean media reported that he had fled because of “inhuman treatment” and racism within the US military.
He became the first American to be detained in North Korea in nearly five years.
King was released two months later after “intense diplomacy”, US officials said at the time. He was taken by a state department aircraft to a US airbase in South Korea.
On 28 September 2023, he was flown back to Texas and had been in custody there since.
The following month, he was charged by the US military with desertion, kicking and punching other officers, unlawfully possessing alcohol, making a false statement and possessing a video of a child engaged in sexual activity.
King pleaded guilty to charges including desertion, three counts of disobeying an officer and assault on a non-commissioned officer.
The other charges, however, were dismissed after the government made a motion to do so, which was granted by the judge.
The Associated Press reported in July that King’s lawyers were in talks with military prosecutors to work out a plea deal. A preliminary hearing was scheduled that month, but was postponed so both sides could negotiate.
In his statement, Mr Rosenblatt said he believes that despite his client walking away free on Friday, "the negative public perception" and the time King has spent in custody "represents an ongoing punishment that he will endure for the rest of his life".