Choi Soon-sil, center, at a hearing in January in Seoul. (Kim Hong-Ji/AFP/Getty Images)

The confidante of former South Korean president Park Geun-hye was sentenced Tuesday to 20 years in prison and fined almost $17 million for her role in a huge corruption scandal that led to Park’s impeachment and continues to roil the country.

The heavy sentence handed down to Choi Soon-sil bodes ill for Park, who is still on trial and is facing almost the same charges.

Choi took advantage of her “long-running, private ties” with Park, Judge Kim Se-yoon said, to force big South Korean companies such as Samsung to give donations to two foundations, which were meant to be used to encourage sports but were instead slush funds for Park and Choi.

“In light of the size of material gains obtained by the accused, the severe confusion in state affairs caused by her crimes and the people’s sense of frustration, the guilt of the accused is very heavy,” the judge said, according to reports from inside the packed courtroom.

Choi, 62, has been friends with Park for about four decades. Choi’s father, a kind of shaman-fortune teller, was close to Park’s father, Park Chung-hee, who served as South Korea’s strongman president from 1963 until he was fatally shot by his own spy chief in 1979.

After Park’s mother was assassinated in 1974, the shaman reportedly began conveying to Park messages from her mother in the afterlife. This led U.S. diplomats in Seoul to call him a “Korean Rasputin,” according to a leaked U.S. State Department cable.

When Choi’s father died in 1994, she apparently took over his role of providing spiritual advice to Park, who was estranged from her siblings.

Their relationship grew closer as Park rose through the political ranks.

Once Park became president, Choi — who held no official role or security clearance — was involved in matters ranging from the presidential wardrobe to international policy speeches.

All the while, Choi allegedly sought “donations” for her foundations from the big companies that form the backbone of South Korea’s economy and continue to have cozy ties to government authorities.

Park’s presidential Blue House was the “main agent” in setting up bogus foundations to accept donations from big businesses, the court said.

The court found that Choi had forced about 50 businesses to pay a total of $71 million to the two foundations.

Prosecutors had sought a 25-year prison sentence and a $109 million fine. The court gave Choi, who had pleaded not guilty, a lighter sentence. But her lawyers complained that it still bordered on “cruelty” and vowed to appeal.

Choi did not betray any emotion after the sentence was read, and she left courtroom quietly, according to media reports.

Samsung, South Korea’s largest conglomerate, was the company most involved in Choi’s scheme.

Lee Jae-yong, the de facto head of Samsung, was convicted in July of paying bribes totaling $6.4 million to Choi, embezzling corporate money to fund the bribes, then lying about it. He and other Samsung executives were accused of promising to pay $30 million more in bribes to Choi.

Lee was sentenced to five years in prison, but a South Korean appeals court last week freed him only six months into his term.

His charges related to allegations that Samsung had paid money to Choi on the understanding that she would make sure the conglomerate won regulatory approval for a huge merger that was crucial for the Lee family’s efforts to keep control of the group.

Lee’s release last week notwithstanding, others involved in Choi’s scheme have been sentenced to time behind bars.

Shin Dong-bin, chairman of Lotte Group, South Korea’s fifth-largest conglomerate, was sentenced Tuesday to 2½ years in prison. He was convicted of paying about $7 million to Choi’s foundations to win approval for a license for Lotte’s duty-free business.

“The situation was unexpected, and we are in despair,” Lotte said in a statement. “We respect the court’s decision, but the result is very regrettable.”

A senior adviser to Park was also sentenced to jail Tuesday. An Chong-bum, who was senior presidential secretary for policy coordination, received a six-year sentence and a $92,000 fine for his involvement in Choi’s influence-peddling scheme.

All eyes are now on Park, the disgraced former president.

After months of huge protests at the end of 2016 and beginning of 2017, Park was impeached in March last year. She was arrested soon afterward and has been in detention ever since, complaining vigorously about the conditions in her prison cell.

She is now on trial on several charges including bribery, coercion and abuse of power. But she has continued to profess her innocence and refused to attend her trial, saying she is the victim of “political revenge.”