SEOUL (Reuters) - South Korean President Moon Jae-in said on Thursday that a 2015 agreement with Japan over South Korean “comfort women” forced to work in wartime brothels was seriously flawed after Japan said any attempt to revise it could damage relations.

A South Korean panel set up to investigate the deal concluded on Wednesday that it failed to meet the needs of the thousands of girls and women forced to work in Japan’s military brothels, many of them Korean, euphemistically termed “comfort women” by Japan.

The announcement threw ties into doubt as both countries, important U.S. allies, seek to rein in North Korea’s nuclear and missile programs.

“The agreement cannot solve the comfort women issue,” Moon said, calling the deal a “political agreement that excludes victims and the public” and violates general principles in international society, according to a statement issued by his office.

A Japanese foreign ministry spokeswoman said Japan had conveyed its position to South Korea through diplomatic channels following Moon’s remarks, reiterating Foreign Minister Taro Kono’s comment on Wednesday that any attempt to change the deal would be “unacceptable” and make relations “unmanageable.”

Japan’s Kyodo news agency quoted an unnamed Japanese government source as saying it had become difficult for Prime Minister Shinzo Abe to visit South Korea in time for the Winter Olympics in Pyeongchang in February, in a potential sign of chilling ties.

The U.S. State Department stressed the importance the United States attaches to a strong relationship between its two key allies in Asia.

“We have long encouraged all parties to work together and approach this sensitive issue in a way that will promote healing, reconciliation, and mutual trust,” State Department spokesman Michael Cavey said.

“We remain focused on regional security issues, including maximizing pressure on the North Korean regime with the unified message that North Korea must abandon its nuclear and missiles weapons program.

Asked if Moon meant to declare the deal null and void, a spokesman for the South Korean presidency, Park Soo-hyun, said it was “inappropriate” for him to use that term at this point, adding the government would present its “final position.”

South Korea's President Moon Jae-In delivers a statement during the 19th Association of Southeast Asian Nations (ASEAN)-Republic of Korea Summit on the sidelines of the 31st ASEAN Summit and Related summits at the Philippine International Convention Center (PICC) in Manila, Philippines November 13, 2017. REUTERS/Noel Celis/Pool

JAPANESE APOLOGY

Under the 2015 deal, Japan apologized to victims and provided 1 billion yen ($8.8 million) to a fund to help them.

The two governments had agreed the issue would be “irreversibly resolved” if both fulfilled their obligations.

Moon pledged to normalize relations and work toward “future-oriented cooperation” with Japan.

Japan’s Nikkei business daily on Thursday quoted Abe as telling people close to him that the agreement “will not be changed by even one millimeter.”

South Korean Foreign Ministry spokesman Roh Kyu-deok said that “regardless of the Japanese government’s stance, we take the investigation results seriously and humbly.”

He said Seoul would formulate follow-up measures as soon as possible that could help the victims “regain honor and heal the wounds in their hearts.”

Japan and South Korea share a bitter history, including Japanese colonization, but are key to international efforts to rein nuclear and missile programs North Korea is pursuing in defiance of U.N. Security Council resolutions.

The comfort women issue has regularly been a source of rancor between Japan and neighbors China and North and South Korea. Japan colonized the Korean peninsula between 1910 and 1945 and occupied parts of China before and during the war.

The legacy of colonial rule, especially the comfort women issue, remains highly sensitive in South Korea, while in Japan, some ultra-conservatives deny that the women were forced to work in brothels.

The liberal Moon came to power in May winning a snap election called after the removal of his disgraced predecessor, Park Geun-hye, whose conservative government was criticized for failing to fully consult victims ahead of the 2015 settlement.

Moon pledged to renegotiate the agreement while on the campaign trail.

A poll in December last year showed 59 percent of South Koreans thought the deal should be nullified while 25.5 percent supported it.

Park was forced from power this year over a corruption scandal and is on trial.