When Kim Jong Un inherited power in North Korea in late 2011, then-Chinese president Hu Jintao was outwardly supportive of the untested young leader, predicting that "traditional friendly cooperation" between the countries would strengthen.
Two years later, Kim ordered the execution of his uncle Jang Song Thaek, the country's chief interlocutor with China and a relatively reform-minded official in the hermetic state.
Since then, ties between the allies have deteriorated so sharply that some diplomats and experts fear Beijing may become, like Washington, a target of its neighbour's ire.
While the United States and its allies - and many people in China - believe Beijing should do more to rein in Pyongyang, the acceleration of North Korea's nuclear and missile capabilities has coincided with a near-total breakdown of high-level diplomacy between the two.
Before retiring this summer, China's long-time point man on North Korea, Wu Dawei, had not visited the country for over a year. His replacement, Kong Xuanyou, has yet to visit and is still carrying out duties from his previous Asian role, travelling to Pakistan in mid-August, diplomats say.
Until his death in 2011, North Korean leader Kim Jong Il made numerous entreaties to ensure China would back his preferred son as successor.
While then-President Hu reciprocated, the younger Kim, in his late 20s at the time, began to distance himself from his country's most powerful ally.
"There's a lot of domestic politics in North Korea where this young leader who isn't well-known, he's not proven yet, especially has to show that he's not in the pocket of Beijing," said John Delury of Seoul's Yonsei University. "I think he made the decision first to keep Hu Jintao and then (current President) Xi Jinping really at bay."
Within months of coming to power, Kim telegraphed North Korea's intentions by amending its constitution to proclaim itself a nuclear state. The execution of Jang's uncle in 2013 sealed Beijing's distrust of the young leader.
"Of course the Chinese were not happy," said a foreign diplomat in Beijing focused on North Korea. "Executing your uncle, that's from the feudal ages."
Mao Zedong's description of North Korea's relationship with China is typically mis-characterised as being as close as "lips and teeth".
His words are better translated as: "If the lips are gone, the teeth will be cold," a reference to the strategic importance of the North as a geographical security buffer.
Despite its resentment at the pressure North Korea's actions have put it under, Beijing refrains from taking too hard a line.
It said little when Kim Jong Un's half-brother was assassinated in February at Kuala Lumpur's airport. The half-brother, Kim Jong Nam, had been seen as a potential rival for power in Pyongyang and had lived for years in Beijing, then Macau.
An editorial in China's influential Global Times warned after Pyongyang's latest nuclear test that cutting off North Korea's oil would redirect the conflict to one between North Korea and China.
Zhao Tong, a North Korea expert at the Carnegie-Tsinghua Center in Beijing, said North Korea was deeply unhappy with China's backing of earlier UN sanctions.
"If China supports more radical economic sanctions that directly threaten the stability of the regime, then it is possible that North Korea becomes as hostile to China as to the United States."