“The leaders of South and North Korea visiting China one after the other — it reflects China’s growing influence on the Korean Peninsula,” said Kim Yong-hyun, a political scientist at Dongguk University in Seoul. “South Korea’s attempt to punish North Korea depends largely on Chinese cooperation. With its relations with South Korea in a shambles, North Korea now has to depend more on China for economic help.”

Image The North Korean leader Kim Jong Il leaving a hotel in Dalian, northeastern China, on Monday. Credit... Kyodo News, via Associated Press

Mr. Kim, 68, ailing and reportedly preparing to bequeath power to his son, Kim Jong-un, 27, is facing both external and internal pressures that are forcing him to reach out to China. His government’s disastrous currency revaluation in November, meant to curb free markets, triggered inflation and deepened food shortages. United Nations sanctions tightened after the North’s nuclear test in 2009 had already curtailed the North’s ability to earn hard currency abroad.

A trip by Kim Jong-il raises hopes that the North might return to six-nation talks on ending its nuclear weapons program. His previous trips to China have led to fresh aid shipments from China in exchange for gestures toward easing tensions in the region.

Although China is the only country with sufficient economic leverage to drive the North to the brink of collapse or to wring concessions on its nuclear weapons development, its top priority has been preventing the implosion of the Pyongyang regime, which would cause instability on its border, analysts say.

“China’s national interest remains the same,” said Daniel Pinkston, an expert on North Korea for the International Crisis Group. “It will continue to ask North and South Korea to exercise restraint and refrain from using violence and taking provocative actions that could cause instability.”

If North Korea indeed torpedoed the South Korean ship, as many South Koreans suspect, analysts said that the North probably was avenging its military’s humiliating defeat in a naval skirmish with the South last November and was trying to gain ground in its diplomacy.

Mr. Pinkston said: “Now maybe they believe: ‘We are even now. We can now begin returning to diplomacy with some confidence and comfort to comply with what the Chinese will be asking or encouraging us to do.’ ”