BEIJING — The foreign ministers of South Korea and China on Wednesday affirmed their commitment to repair strained relations ahead of a visit by South Korean President Moon Jae-in to Beijing next month and amid ongoing concerns over North Korea’s nuclear weapons program.

The talks between Kang Kyung-wha, the South Korean diplomat, and Chinese Foreign Minister Wang Yi at the Diaoyutai State Guesthouse in Beijing came shortly after a Chinese special envoy wrapped up a visit to North Korea, which China is attempting to convince to return to nuclear disarmament talks.

China’s relations with South Korea soured last year over the deployment of a U.S. anti-missile defense system in South Korea that Beijing fears will be able to monitor military activity in northeastern China.

“China attaches great importance to the Republic of Korea’s statement that deployment of the THAAD system will not damage China’s security interests,” Wang said in opening remarks, referring to the Terminal High-Altitude Area Defense shield intended to thwart North Korea’s missile threat.

“We hope the South Korean side will continue to appropriately handle the matter,” he said.

Kang referred to a consensus reached between the sides to improve relations expressed through an Oct. 31 joint statement and worked out through contacts between their leaders at recent regional summits in Vietnam and the Philippines.

“We both realize that continued conflict is in neither of our interests, so we have come to this outcome,” Kang said.

China responded to the THAAD deployment with economic retaliation, banning group tours to South Korea, pulling South Korean soap operas off the air and disrupting activities of South Korean supermarkets and other businesses within China. Visits by prominent South Koreans to China, from actors and boy bands to high-ranking government officials, also slowed.

While South Korea resisted China’s demands to withdraw the system, Beijing appeared satisfied with a pledge from Seoul not to expand it, among other commitments. That has set the stage for a visit by Moon, who has struggled to balance South Korea’s close political and military ties with the U.S. with its economic dependency on the Chinese market.

Beijing, meanwhile, has grown increasingly frustrated with North Korea over its nuclear and missile tests that have brought the threat of war and chaos to China’s northeastern border.

In what was seen as a bid to get relations back on track, Song Tao, the head of China’s ruling Communist Party’s International Department, traveled to Pyongyang on Friday to report on the outcome of the party’s national congress held last month.

Song, as Chinese president and party leader Xi Jinping’s special envoy, reportedly met with North Korean counterparts but few details have been given about his itinerary or meetings, including whether he met with North Korean leader Kim Jong Un. That visit followed a stop in Beijing earlier this month by U.S. President Donald Trump, who renewed calls for China to step up pressure on North Korea to agree to United Nations demands to end its missile and nuclear programs.

China is North Korea’s only significant ally and main trading partner but has been tightening enforcement of U.N. economic sanctions aimed at cutting off the North’s sources of hard currency.

State-owned airline Air China suspended flights Tuesday between Beijing and North Korea due to a lack of demand, deepening the North’s isolation amid the mounting U.N. sanctions.