SEOUL, South Korea — Samsung heir Lee Jae-yong was freed Monday after a South Korean appeals court gave him a 2 ½-year suspended jail sentence for corruption in connection with a scandal that toppled the country’s president.

The Seoul High Court softened the original ruling against Lee, rejecting most of the bribery charges leveled against Lee by prosecutors who sought a 12-year prison term.

While the ruling clears the way for the Samsung vice chairman to resume his role at the helm of the industrial giant founded by his grandfather after a year in prison, he faces a slew of challenges outside prison.

Chief among them will be winning trust that he is capable of running South Korea’s biggest company, and assuaging public anger among those who viewed the court’s surprise decision as a setback in the war on corruptions.

“The past year was a precious time for personal reflection,” Lee told reporters waiting outside the gates of a detention center in southern Seoul.

Lee’s first stop from the prison was a Samsung hospital where his father has been hospitalized after suffering a heart attack in 2014.

Lee was charged with offering $38 million in bribes to former President Park Geun-hye and her confidant Choi Soon-sil, embezzling Samsung funds, hiding assets overseas, concealing proceeds from criminal activities and perjury.

The appeals 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 ($3.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 that the Samsung vice chairman still plans to appeal his conviction. Prosecutors also were expected to appeal the court’s ruling, making it almost certain the case will go to the Supreme Court.

Lee, 49 and the only son of Samsung’s ailing chairman, was given a five-year prison term in August on bribery and other charges linked to a political scandal that took down former South Korean President Park Geun-hye.

Lee has pleaded not guilty to charges he used Samsung corporate funds to bribe Park and a confidante, seeking to consolidate his control over Samsung and facilitate a smooth transfer of corporate leadership from his father. The appeals court rejected the lower court’s view that corporate succession was one of the issues at stake.

Many South Koreans were expecting a tough stance from the appeals court and took to social media and online news portals to vent their 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 in Korean.

The earlier ruling against Lee was seen as a departure from the previous court cases that had been criticized for being too soft toward white-collar crime and toward executives of chaebol, the big conglomerates that helped South Korea’s rapid industrialization.

Lee’s case and the current trial of the former president are seen as tests of the country’s commitment to ending cozy ties among South Korea’s political and business elite. Such links once were 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 ($7.3 million) to Samsung Electronics. The lower court had said Lee embezzled that amount from Samsung to bribe Choi.