BEIJING — When a retired Chinese general with impeccable Communist Party credentials recently wrote a scathing account of North Korea as a recalcitrant ally headed for collapse and unworthy of support, he exposed a roiling debate in China about how to deal with the country’s young leader, Kim Jong-un.

For decades China has stood by North Korea, and though at times the relationship has soured, it has rarely reached such a low point, Chinese analysts say. The fact that the commentary by Lt. Gen. Wang Hongguang, a former deputy commander of an important military region, was published in a state-run newspaper this month and then posted on an official People’s Liberation Army website attested to how much the relationship had deteriorated, the analysts say.

“China has cleaned up the D.P.R.K.'s mess too many times,” General Wang wrote in The Global Times, using the initials of North Korea’s formal name, the Democratic People’s Republic of Korea. “But it doesn’t have to do that in the future.”

Of the government in North Korea, he said: “If an administration isn’t supported by the people, ‘collapse’ is just a matter of time.” Moreover, North Korea had violated the spirit of the mutual defense treaty with China, he said, by failing to consult China on its nuclear weapons program, which has created instability in Northeast Asia.