A South Korean court declined early Thursday to allow the arrest of Samsung’s de facto chairman for his alleged role in an explosive corruption scandal that has riveted South Korea.

The decision is a shocking one for prosecutors, who have accused Lee Jae-yong of bribery, embezzlement and perjury, although the court decided only that Lee did not need to be detained, not that the case had no merit.

It will also come as a surprise to a general public clamoring for justice in the widening scandal, which has already forced the president out of office, at least temporarily. Protesters had been calling for Lee's arrest.

Samsung welcomed the decision. “We appreciate the fact that the merits of this case can now be determined without the need for detention,” said Rhee So-eui, a spokeswoman for the company.

Just before 5 a.m. local time Thursday, judges in the Seoul Central District Court said they found no reason to issue a warrant for the arrest of Lee, who has been running South Korea’s largest conglomerate for almost three years while his ailing father, who officially remains chairman, lies unconscious in hospital.

Lee, who has vehemently denied being involved in any bribery scheme, had been waiting at a detention center south of Seoul for some 18 hours while the court decided, apparently expecting to be arrested following a four-hour court hearing Wednesday morning.

At that hearing, his attorneys argued against his arrest and detention while the investigation continued. “We fully explained [our position] to the court,” Song Woo-chul, an attorney for Lee, told reporters after the hearing. “We are sure that the court will make a wise decision.”

The widening corruption and influence-peddling scandal that has riveted South Korea and brought it to a political halt revolves around allegations of bribery and influence at the highest levels.

The National Assembly voted to impeach President Park Geun-hye last month over her alleged role in the case, leading to her suspension from office while the Constitutional Court decides whether to approve her impeachment. That decision could come as soon as next month.

Now, as Samsung’s flagship electronics unit struggles to emerge from its recall of the Galaxy Note 7 smartphone last year, its leader has become embroiled in the scandal.

Special prosecutors appointed to investigate the case accused Lee of authorizing at least $36 million in payments to Choi Soon-sil, a confidante of the president who held no official position.

Choi allegedly put pressure on authorities to approve the $8 billion merger of two Samsung units, part of a plan to strengthen the family’s hold on the group, which it controls through a complex web of cross-shareholdings despite owning only a tiny stake of it.

The National Pension Service, a major Samsung shareholder, is suspected of supporting the merger on Choi’s instruction. The head of the service, a former health minister, was indicted Monday in relation to the scandal.

Choi, on trial for alleged bribery, coercion and abuse of power, has denied trading on her relationship with the president. “I have never received any special benefits or treatment from the government,” she said during a court hearing Tuesday, according to local reports. “The president is also not such a person.”

At a parliamentary hearing last month, Lee denied being involved in any bribery scheme but acknowledged that Samsung had given a $900,000 horse to Choi’s daughter, an Olympic equestrian hopeful.

Bribery and corruption have long been a hallmark of business dealings in South Korea, and the alleged involvement of the conglomerates, known here as “chaebol,” has angered the public at a time of growing social and economic inequality.

The special prosecutor had indicated that SK, Lotte and CJ, all second-tier conglomerates, were next in its sights.

Conglomerates are accused of giving a total of $70 million to two foundations run by Choi, ostensibly sports and cultural charities. Prosecutors allege that they were in fact cover for bribes paid to Choi to help secure favorable treatment for their businesses.

Yoonjung Seo contributed to this report.

Read more: