Yoon Suk Yeol, a conservative former top prosecutor, was elected South Korea’s new president on Thursday, defeating his chief liberal rival in one of the country’s most closely fought presidential elections.

With more than 98% of the ballots counted, Yoon had 48.6% of the votes against his rival Lee Jae-myung’s 47.8 %.

A huge crowd of supporters gathered near Yoon’s Seoul home, shouting his name early Thursday.

“I didn’t know you’ve come here without sleeping. I thank you for having supported me so far. Thank you, my neighbors!” Yoon said. He was expected to make a formal victory speech soon.

Also read | Antarctic explorer Ernest Shackleton’s sunk ship found after a century

Yoon is to take office in May and serve a single five-year term as leader of the world’s 10th largest economy.

Earlier, Lee, a former governor of Gyeonggi province, conceded his defeat at his party headquarters. “I did my best but wasn’t able to live up to expectations,” a glum Lee said. “I congratulate candidate Yoon Suk Yeol. I sincerely ask the president elect to overcome division and conflicts and open a new era of unity and harmony.”

The election boiled down to a two-way showdown between Yoon from the opposition People Power Party and Lee from the governing Democratic Party. They spent months slamming, mocking and demonizing each other in one of the most bitter political campaigns in recent memory, aggravating the country’s already severe domestic divisions.

Critics say neither candidate has presented a clear strategy for how they would ease the threat from North Korea and its nuclear weapons. They also say voters are skeptical about how both would handle international relations amid the U.S.-China rivalry and how they would address widening economic inequality and runaway housing prices.

Also read | US Secretary of State Antony Blinken sure Russia will lose against Ukraine

Yoon says he would sternly deal with North Korean provocations and seek to boost trilateral security cooperation with Washington and Tokyo. Yoon has said he would make a enhanced alliance with the United States the center of his foreign policy while taking a more assertive stance on China.

After North Korea’s latest reported ballistic missile launch on Saturday, Yoon accused North Korean leader Kim Jong Un of trying to influence the results of the South Korean election in favor of Lee.

“I would (teach) him some manners and make him come to his senses completely,” Yoon told a rally near Seoul.

Lee, for his part, has called for greater reconciliation with North Korea and a diplomatic pragmatism amid the U.S.-China confrontations.

The election comes as South Korea has been grappling with an omicron-driven COVID-19 surge. On Wednesday, health authorities reported 342,446 new virus cases, a record high. People infected with the coronavirus voted after regular voting ended Wednesday evening.

Also read | US authorities charge two siblings in $124 million cryptocurrency fraud

South Korea’s Constitution limits a president to a single five-year term, so Lee’s party colleague, President Moon Jae-in, could not seek reelection. Moon came to power in 2017 after conservative President Park Geun-hye was impeached and ousted from office over a huge corruption scandal.

With conservatives initially in shambles after Park’s fall, Moon’s approval rating at one point hit 83% as he pushed hard to achieve reconciliation with North Korea and delve into alleged corruption by past conservative leaders. He eventually faced a strong backlash as talks on North Korea’s nuclear program faltered and his anti-corruption drive raised questions of fairness.

Yoon had been Moon’s prosecutor general but resigned and joined the opposition last year following infighting over probes of Moon’s allies. Yoon said those investigations were objective and principled, but Moon’s supporters said he was trying to thwart Moon’s prosecution reforms and elevate his own political standing.

Yoon’s critics have also attacked him over a lack of experience in party politics, foreign policy and other key state affairs. Yoon has responded that he would let experienced officials handle state affairs that require expertise.