China may be "as close as lips and teeth" to North Korea, and is the secretive Stalinist state's only major ally, but Beijing was keeping a very cautious eye on events as they unfolded yesterday. China backed North Korea during the 1950-53 Korean War; today its food supplies and oil are said to be the only thing keeping North Korea going.
"We have expressed the people's deep condolences to the people of North Korea. Comrade Kim Jong-il was a great friend of the Chinese people. We believe the North Korean people will turn grief into strength and unity, and that North Korea will continue to drive the cause of socialism," foreign ministry spokesman Ma Zhaoxu told the state broadcaster CCTV.
The Cold War language used by China is echoed in the statements from North Korea, and shows how close the two countries are. Under Mao Zedong, China used to be very like North Korea – isolated, xenophobic and aggressive to its neighbours, but it has become a more tolerant and open place in the past three decades. Some say that Kim Jong-il was hoping to emulate China's success, by opening up to market forces, but keeping a tough grip on political freedoms.
In Beijing yesterday, the North Korean embassy opened to allow in people carrying bunches of white flowers. Replicating the scenes from Pyongyang seen on television yesterday, telephone operators, connecting Chinese callers to North Korea were in tears.
But the extent to which China was developed since its adoption of market forces and "controlled capitalism" was clearly in evidence. One popular website said "Kim Jong-il's Death Shows the Importance of Losing Weight". The subtitle was even more subversive: "A government is just like a human body, in that neither can afford to be too fat." The New York Times reported that the page was still online last night.
Just how important China is to the transfer of power was underlined by Mr Kim before he died. In order to secure that the succession was a peaceful one, he boarded his bullet-proof train and went to China last year to meet senior officials, including President Hu Jintao. If China backed him, as they did, then the dynasty was set to continue, and it is the implementation of this plan that we are seeing, seemingly with Chinese permission.
Cai Jian, deputy head of the North Korea section of the Institute of International Studies at Fudan University in Shanghai, said unrest in North Korea was not good for China.
"If power is not transferred peacefully to his son, it could undermine the balance in the region, with the US and other Western powers getting involved," said Mr Cai.
China is the regional powerhouse and what it definitely does not want is for the world's only communist dynasty to topple.
It is likely that Beijing will continue to offer economic support to North Korea in exchange for social stability, and political support in exchange for helping maintain the regional balance of power.
On the one hand, the North Korean economy is precarious, and were it to collapse, a stream of refugees would flood into China. More seriously from the standpoint of Beijing is South Korea extending its influence into the North. In the event of the breakdown of the North Korean economy, this could theoretically mean US troops at the Chinese border, given the defence of South Korea is guaranteed by large numbers of American military.
"It is critically important for North Korea to have China's support, to have the approval for Kim Jong-un succeeding Kim Jong-il. I think security will be stepped up in North Korea, and China is also likely to tighten security along the border," said Mr Cai.
For China, North Korea is a vital buffer state. This means China has put up with various indiscretions by the state it sees as its ideological "little brother", including a nuclear test in 2009, which took Beijing completely by surprise.
A joke doing the rounds at the time had the North Koreans ringing up Beijing to say they were testing a nuclear weapon. "When?" asked the Chinese government official. "10... 9... 8..." ran the reply.