Samsung heir Lee Jae-yong has been freed from jail after a South Korean appeal court gave him a two-and-a-half-year suspended sentence for corruption in connection with a scandal which toppled the country's president.
The ruling clears the way for the vice chairman, who has spent a year in prison, to resume his role at the helm of the technology giant founded by his grandfather.
In a surprise decision, the Seoul High Court softened the original ruling against Lee, rejecting most of the bribery charges levelled against him by prosecutors who had been seeking a 12-year jail term.
"The past year was a precious time for personal reflection," Lee told reporters waiting outside the gates of a detention centre in southern Seoul.
His first stop after leaving prison was a hospital where his father has been treated since he suffered a heart attack in 2014.
Lee was charged with offering $38 million (£26.9 million) in bribes to former president Park Geun-hye and her confidante, Choi Soon-sil, embezzling Samsung funds, hiding assets overseas, concealing proceeds from criminal activities and perjury.
The appeal court said Lee was unable to reject the then-president's request to financially support her confidante and was coerced into making the payments.
The court still found Lee guilty of giving 3.6 billion won (£2.3 million) in bribes for equestrian training of Choi's daughter and of embezzling the money from Samsung funds.
Lee's lawyer, Lee Injae, told reporters outside the court that, while he respects the court's courage and wisdom, Lee still plans to appeal over his conviction.
Prosecutors were also expected to appeal against the court's ruling, making it almost certain that the case will go to the Supreme Court, the final court of appeal in South Korea.
Lee, 49 and the only son of Samsung's ailing chairman, was given a five-year prison sentence in August on bribery and other charges linked to that brought down former Ms Park.
He pleaded not guilty to charges that he used Samsung corporate funds to bribe Ms Park and a confidante, seeking to consolidate his control over Samsung and facilitate a smooth transfer of corporate leadership from his father.
The appeal court said there was no corporate succession issue at stake, rejecting the lower court's view.
The more lenient ruling surprised many who were expecting a tough stance from the appeal court and many South Koreans took to social media and online news portals to express anger at the ruling and the judge who issued the verdict.
"Republic of Samsung" and the name of the judge who handed down Monday's verdict were among the top trending words on Twitter.
The earlier ruling against Lee was seen as a departure from the previous court cases that had been criticised for being too lenient towards white-collar crime and towards executives of chaebol, the big conglomerates that helped South Korea's rapid industrialisation.
Lee's case and the current trial of the former president are seen as tests of the country's commitment to ending cosy ties among South Korea's political and business elite.
Such links were once seen as the key to South Korea's impressive rise from the ashes of its 1950-53 war but now are blamed for corruption, inequality and stifling innovation.
Before the final hearing at the appeals court Lee paid back 8 billion won (£5.8 million) to Samsung Electronics. The lower court had said Lee embezzled that amount from Samsung to bribe Choi.
Despite Lee pleading not guilty, few South Koreans had expected him to walk out of prison.