Updated

Liberal Moon Jae-in declared victory in South Korea's presidential election Tuesday, setting the country up for its first liberal rule in a decade while fending off accusations of being aligned with North Korea.

The election followed months of political turmoil caused by ousted President Park Geun-hye's corruption scandal.

"I gave all my body and soul (to the election) to the very end," Jae-in told reporters while casting his ballot in Seoul.

The 64-year-old thanked people who stood with him to bring change. He said he and his party "invested all our efforts with a sense of desperation, but we also felt a great desire by people to build a country we can be proud of again."

Park is jailed awaiting trial later this month on bribery, extortion and other corruption charges.

Concessions by conservative Hong Joon-pyo and centrist Ahn Cheol-soo -- Jae-in’s major rivals -- came after exit polls forecast that Moon would win.

Joon-pyo described South Korea's presidential election as a war between ideologies and accused Jae-in of being aligned with North Korea.

Joon-pyo said Tuesday that the election was a "war of regime choices between people, whether they decide to accept a North Korea-sympathizing leftist government or a government that can protect the liberty of the Republic of Korea." That is South Korea's formal name.

Joon-pyo pitched himself as a "strongman" who could hold his own against other "nationalist" leaders in Washington, Tokyo and Beijing. He also calls for the United States to bring back tactical nuclear weapons to South Korea after withdrawing them in the 1990s.

Japan’s Chief Cabinet Secretary Yoshihide Suga said the neighboring countries share common strategic interests.

"We believe Japan-South Korea cooperation on issues such as North Korean problem is indispensable for the peace and stability in our region,” he said Tuesday, according to The Associated Press.

Suga urged a new president to comply with the 2015 bilateral agreement aimed at resolving the longstanding "comfort women" dispute involving many Koreans and other women in Asia sexually abused at Japanese military brothels before and during World War II. The row persists over a statue built outside the Japanese consulate in Busan.

The Associated Press contributed to this report.