When Zhang Xun, China’s ambassador to Syria, arrived in Damascus more than two years ago there were 1,200 Chinese citizens living in the country, most of them employed as labourers on energy and industrial projects.

Today there are only about 30 Chinese citizens left in Syria, including diplomatic staff, who are subjected to regular mortar and gunfire attacks on the embassy and surrounding buildings.

The latest incident occurred in early October when a shell landed in the embassy compound, shattering windows, damaging a wall and injuring a Syrian employee.

The mission is a target for rebel attacks thanks to Beijing’s decision to join Russia in vetoing three resolutions on Syria in the UN Security Council.

“To be honest, it would be a lie if I said I’m not a little bit scared,” Mr Zhang said in a recent interview with Global Times, a state-controlled Chinese newspaper. But “the situation in Syria is special. In consideration of the relations between big powers and the international order, we decided to stay here.”

Even many prominent Chinese foreign policy makers and analysts have (quietly and privately) questioned Beijing’s approach to the Syrian crisis.

“We don’t seem to have a real strategy on Syria; we’re caught between the old policy of ‘tao guang yang hui’ [literally, ‘hiding one’s brilliance and biding one’s time’] and attempts to be more active in defending our interests abroad,” said one person who is often asked to advise senior Chinese leaders on foreign policy.

The phrase formulated under former paramount leader Deng Xiaoping in the late 1970s has been the guiding philosophy for Chinese diplomacy for decades.

It amounts to a blanket policy of non-interference in the internal affairs of other countries and a corresponding fierce resistance to any criticism or meddling, particularly from the west, in China’s own domestic situation.

But as China’s economic and commercial interests grow around the world Beijing is finding it increasingly hard to ignore conflicts and crises in far-flung places beyond its borders.

The civil war in Libya was a wake-up call that forced Beijing to launch a costly emergency evacuation of 36,000 of its citizens and abandon billions of dollars worth of investment.

That episode prompted many within the Chinese system to call for a more coherent and activist foreign policy that does more to protect Chinese overseas interests.

In the case of Syria that does not apply as China had limited direct interests in the country before the conflict.

Western diplomats say China, unlike Russia, sells barely any weapons to the regime of President Bashar al-Assad and, apart from a couple of small energy projects owned by state-owned oil group CNPC, Chinese investment in the country is “negligible”.

So why has Beijing insisted on protecting the Assad regime at the UN, even though this damages its reputation in the region?

The Libyan experience is key to understanding why China has taken its position, according to analysts, officials and diplomats in Beijing.

By agreeing to abstain from a UN vote that authorised a limited mission to protect civilians in Benghazi, Beijing feels it was tricked into accepting western-led regime change in Libya.

“Chinese officials see the Libyan example as a terrible precedent that could lead to regime change elsewhere,” says one western diplomat who closely follows China’s Middle East policy. “They see the road from Libya leading to Damascus then Iran then North Korea and eventually to China.”

Another important factor for Beijing is its desire to improve relations with Russia, a central element of President Xi Jinping’s foreign policy agenda.

At a meeting last week between Mr Xi and Vladimir Putin, the Russian president praised the two countries’ ability to “achieve co-ordinated decisions on the most difficult matters, with Syrian issues being the latest example”.

Chinese analysts say Beijing is backing Moscow at the UN so Russia will be supportive in the future if China faces international pressure or further territorial disputes with neighbours.

Some diplomats and analysts also believe Russia and China have cut a bargain under which China will support Russia’s position in Syria and Moscow will help Beijing to support Iran, where extensive Chinese investments have been hurt by US-led sanctions.

The growing alliance between China and Russia is also intended to counter continued US dominance throughout the world.

“The US still thinks in terms of the Cold War and tries to squeeze China and Russia’s strategic space so China and Russia have to hold each other close to keep warm,” says Ma Xiaolin, a popular commentator on international affairs who previously worked for Xinhua, the Chinese government’s official mouthpiece.

Beyond its sense of betrayal over Libya or its warming ties with Russia, China’s reactive approach to the Syrian crisis illustrates how painful and slow the transition from total non-intervention to a more engaged and activist foreign policy is going to be.

While many within the system would like to see Beijing take a more assertive posture on the global stage, the country’s most senior leaders are still very much preoccupied with the enormous challenges they face at home.

“There’s a storm outside and they can hear it but they don’t have a window to look out of and it doesn’t really affect them,” one senior foreign policy official told the Financial Times. “When you speak to top leaders about global issues they always ask what it means for [the Chinese provinces of] Henan, Hebei and Guangzhou.”

Copyright The Financial Times Limited 2018. All rights reserved.