North Korea condemns lone ally China publicly for 'first time'

North Korea is not a country with a lot of allies.

So when its state-run news agency appeared to lash out at key supporter China — alleging it was "dancing to the tune of the U.S." — it raised eyebrows.

The ties between Pyongyang and Beijing run deep, with the relationship characterized by some former Chinese leaders as "close as lips and teeth."

"China is North Korea's most important ally, biggest trading partner, and main source of food, arms, and energy," according to a backgrounder published last year by the Council on Foreign Relations. It added that "China provides North Korea with most of its food and energy supplies and accounts for more than 70 percent of North Korea's total trade volume."

However, China disapproves of North Korea's nuclear program and has backed U.N. sanctions against it.

So China banning further imports of coal from North Korea on Sunday was significant. The move was regarded by analysts as a reaction to both the apparent assassination in Malaysia of Kim Jong Nam, the half-brother of North Korean leader Kim Jong Un, and to his regime's recent test of a ballistic missile.

That was followed Thursday by North Korea's state-run KCNA news agency castigating "a neighboring country, which often calls itself a 'friendly neighbor,'" and saying it was "dancing to the tune of the U.S."

Although China wasn't mentioned by name, experts said there was little doubt about which country it was referring to.

Kim Jong Un's government was sending China a message, according to a former diplomat who served in North Korea.

"It's saying to China to 'back off, shut up, leave us alone,'" said James Edward Hoare, who established the British Embassy in Pyongyang in 2001.

He added that is also important to bear in mind that North Korea often does things for domestic consumption.

"Everything in North Korea is stated in highly exaggerated terms," Hoare said.

China needs North Korea for several reasons. Bilateral trade is important not only to North Korea but to parts of China, according to Hoare.

He added that China has no interest in destabilizing the government of its ally, and perhaps in the process bolstering South Korea's claim to be the legitimate government of the entire Korean peninsula. That would result in a unified Korea with a pro-U.S. foreign policy and American troop presence.

However, Beijing also wants to avoid a potential humanitarian crisis on its borders that would be spurred by a collapse of Kim's regime.

So it wasn't surprising that China's public response to the KCNA's statement was mild on Friday.

"China and [North Korea] are friendly neighbors," Chinese Foreign Ministry spokesman Geng Shuang said. "We would like to work together with [North Korea] to develop a healthy and stable .... relationship."

But Professor Hu Xingdou, a political affairs commentator who is based at Beijing Institute of Technology, told NBC News that North Korea is already a "liability" to China.

He said that while "there are already cracks" in the relationship, it was "better to maintain peace on the surface."

Hu added: "It is not the first time North Korea has said things about China like this but it is the first time they have said it so publicly."

North Korea, poor, suspicious of outsiders and governed by a third-generation dictator, is used to being underestimated and mocked. Few believed it could build a nuclear program that would keep U.S. presidents since the early 1990s up at night.

There's a general consensus that Pyongyang has made significant nuclear and missile progress under Kim, who took over after his father, Kim Jong Il, died in late 2011.

Kim has conducted three of the country's five total nuclear tests, including two last year. Propaganda out of Pyongyang makes clear that North Korea views nuclear weapons as essential to keeping at bay U.S. and South Korean forces it says are intent on its destruction.

According to The Associated Press, some U.S. experts believe North Korea may have enough fuel for about 20 bombs and can add a possible half dozen more each year.

Before taking office last month, President Donald Trump complained in a tweet that China was not doing enough to help to contain Pyongyang.

But Hu pointed out that Kim's nuclear program was also a concern for Beijing.

"The potential threat of North Korea's nukes is enormous to China," he said. "Whether they use them or not, there is still potential for a nuclear leak. So the only thing China can do is to take serious action to contain the potential danger."