Whenever Russia and Western powers face off, China stands to gain geopolitical leverage.
This maxim has played out once again amid the crisis in Ukraine.
Faced with the most dangerous confrontation between Russia and US-led Western powers since the end of the cold war, China must avoid angering an ally as well as harming ties with the world's leading superpower.
Russia and China have been allies in the United Nations, acting as a counterweight to the West's domination of global affairs over the past decade.
China was the only member nation on the Security Council to abstain from a resolution to condemn Russia for its actions in Crimea. But analysts say Beijing's support for Moscow faces limits.
"On one hand, Russia's strong-arm tactics and meddling in Ukraine are at odds with China's long-standing commitment to the inviolability of state sovereignty," said Benjamin Herscovitch , a research fellow with Australia's Centre for Independent Studies. "On the other hand, Moscow's disregard for Washington's denunciations pleases Beijing."
There is also a practical reason for Beijing to refrain from endorsing Russia's military invasion: it might give foreign powers an excuse to intervene in China's own territories in the future.
Beijing maintains a strong grip on its far-flung, ethnically diverse Xinjiang and Tibet regions. And the 2005 Anti-Secession Law permits the use of military force against Taiwan, should it declare independence through a referendum or some other official mechanism.
"China is highly ambivalent towards the referendum in Crimea as it is uneasy about the potential implications for its own territorial or ethnic minority issues," said Chengxin Pan , a fellow with Australian Institute of International Affairs.
Sharing more than 4,000 kilometres of border with Russia, China is also worried about the risk of a wider Russian incursion as nationalistic leader Vladimir Putin pokes at Western weakness and tries to restore Moscow's influence over its old Soviet empire.
Beijing has bitter memories of Soviet military action in smaller countries, such as Hungary in 1953 and Czechoslovakia in 1968, which enraged Mao Zedong enough to launch a campaign against "social imperialism". Russian forces helped push Chinese troops out of Mongolia beginning in 1920, and Ukraine's return to the Kremlin's orbit has echoes of "Finlandisation" during the cold war, when the Soviet Union influenced the Nordic country's polices.
Conversely, some Chinese diplomats privately see the Ukraine conflict as a possible means to improving relations between Beijing and Washington, similar to the aftermath of September 11. That event saw a turnaround in Sino-US ties as US President George W. Bush softened his administration's hawkish stance on China.
At the time, the United States needed Beijing as an ally for its goals in the Security Council, and later its objectives in Afghanistan. This support required that Washington place less emphasis on areas of its bilateral ties such as human rights, that traditionally led to friction.
Some Chinese strategists also see Putin's Crimea incursion as challenging Beijing's growing interest in the region. Over the past five years, China has replaced Russia as the dominant foreign presence in Central Asia, through energy deals, extensive oil and gas pipelines, and foreign investment.
China is the largest trading partner of Turkmenistan and Kazakhstan, and the second-largest partner of Uzbekistan and Kyrgyzstan.
With its huge stake, China has an interest in keeping regional peace so it can explore further investment and trade opportunities, and secure a stable supply of energy.
The question of where China will stand in the end has become central to the Ukraine crisis.
When the crisis hit, US President Barack Obama, German Chancellor Angela Merkel and Putin scrambled to reach out to President Xi Jinping.
But Beijing's best strategy is to maintain the status quo in Kiev. Ukraine joining the European Union will not serve China's interests. China's first aircraft carrier, the Liaoning, was made in Ukraine. In addition, Ukrainian companies help maintain the engines of Chinese fighter jets. If Ukraine is recruited into the EU and Nato, it will then be required to follow the groups' arms embargo against China.