The rare public spat between China and North Korea illustrates the dilemma facing Beijing’s leaders as they try to coax Kim Jong Un back to the negotiating table.

North Korea condemned China for banning coal imports in an unusually hostile state-media commentary last week, mocking its ally for “dancing to the tune of the U.S.” and vowing to continue developing nuclear weapons. China stood firm, saying it would implement United Nations Security Council resolutions.

“Does anyone truly believe that the Korean nuclear issue is an easy one to solve, considering it has been with us for these many years?” Chinese Ministry of Foreign Affairs spokesman Geng Shuang asked reporters Friday. The two nations remained “friendly neighbors,” he added.

Tensions have escalated as China seeks renewed talks on North Korea with U.S. President Donald Trump, whose administration is moving to install a missile-defense system this year in South Korea. Yet China’s ability to broker negotiations risks backfiring for a simple reason: Kim is confident that Beijing doesn’t want to see his regime toppled, creating a failed state — or worse, a U.S.-backed unified Korea — on its doorstep.

The current dynamics open the door for a “dramatic act” by North Korea such as another nuclear test, said Zhang Baohui, director of the Center for Asian Pacific Studies at Lingnan University in Hong Kong.

“China is in a no-win situation,” he said. “Its cooperation with the U.S. only deepens the quagmire it faces by creating bigger North Korean provocations.”

North Korea has accelerated its development of nuclear bombs and ballistic missiles since 2009, when it walked away from six-party talks involving China, Japan, Russia, South Korea and the U.S. Ties between China and North Korea been strained since Kim’s ascension in 2011, a year before President Xi Jinping took power. The two have never met as leaders.

China has sought to renew a dialogue with the U.S. over North Korea, arguing that pushing Kim into a corner won’t work because he’ll keep developing a nuclear capability until he feels safe. In a call last week, top Chinese diplomat Yang Jiechi and Secretary of State Rex Tillerson pledged to “address the threat that North Korea poses to regional stability.” On Monday, Yang will make his first trip to the U.S. since Trump took office.

For Xi, sensitivities are heightened as he prepares for the National People’s Congress next week and looks to further consolidate power in twice-a-decade party gathering later this year. South Korea’s bribery crisis involving impeached President Park Geun-hye and Trump’s unpredictability have added to the potential for miscalculations.

The murder of Kim’s older half-brother, Kim Jong Nam, in a Malaysian airport this month has further complicated matters. South Korean officials blamed North Korea for his death and said he had been under Chinese protection.

Malaysian police said last week the older Kim was killed with VX nerve agent, which the U.N. classifies as a weapon of mass destruction. Around that time, the Trump administration canceled plans for informal talks between former U.S. officials and a North Korean delegation, the New York Times reported, citing two people involved in the talks.

Malaysian authorities have declared Kuala Lumpur International Airport safe after a sweep of the terminal found no traces of hazardous materials.

Trump promised to deal with North Korea “very strongly” after its latest missile test and has called on China to get tougher. His plan to deploy a missile-defense system in South Korea is opposed by China in part because it potentially threatens to counter Beijing’s own military capabilities.

China has backed the Kim dynasty since fighting together in the Korean War, and now accounts for more than 80 percent of its trade. While the coal ban took away about half of North Korea’s total exports, analysts say China would do more damage if it halted fuel and commodity sales to its neighbor.

Any U.S.-China detente faces a “realistic limitation” because Beijing opposes a scenario where the regime falls, leading to an influx of North Korean refugees and U.S. troops on its border, according to Liu Ming, director of the Korean Peninsula Research Center at the Shanghai Academy of Social Sciences.

“Pyongyang won’t give up its nuclear weapons and now thinks Beijing is part of an international conspiracy against the regime,” Liu said.

While state-run Korean Central News Agency didn’t mention China by name in its critical commentary, the piece called the coal ban “tantamount to the enemies’ moves to bring down the social system” in North Korea. The U.S. and its allies have normally responded to North Korean provocations with military exercises and other moves designed to intimidate Pyongyang.

That approach is also perilous, Steve Andreasen, a former director for defense policy and arms control on the White House National Security Council, wrote last week on 38 North, a website that analyses the country. The article, titled “Time to Test Diplomacy With North Korea,” was co-bylined with his father, Ottar Andreasen, who served in the Korean War.

“The assumption that the United States and its allies could carefully and gradually escalate military pressure on the North Korean regime to achieve a political outcome without precipitating a military conflict is a weak and dangerous plank for U.S. policy,” they wrote.