Worried about militants sneaking into a restive Chinese region from war-torn Afghanistan, Beijing is in talks with Kabul over the construction of a military base as it seeks to shore up its fragile neighbour.
The army camp will be built in Afghanistan's remote and mountainous Wakhan Corridor, where witnesses have reported seeing Chinese and Afghan troops on joint patrols.
The freezing, barren panhandle of land - bordering China's tense Xinjiang region - is so cut off from the rest of Afghanistan that many inhabitants are unaware of the Afghan conflict, scraping out harsh but peaceful lives.
However they retain strong links with neighbours in Xinjiang, and with so few travellers in the region local interest in the Chinese visitors has been high, residents told Agence France-Presse on a recent visit there.
China's involvement in the base comes as President Xi Jinping seeks to extend Beijing's economic and geopolitical clout.
The Chinese are pouring billions of dollars into infrastructure in South Asia. With Afghanistan's potential to destabilise the region, analysts said any moves there would be viewed through the prism of security.
Beijing fears that exiled Uighur members of the East Turkestan Islamic Movement (ETIM) are passing through the Wakhan into Xinjiang to carry out attacks.
It also worries that ISIL militants fleeing Iraq and Syria could cross Central Asia and Xinjiang to reach Afghanistan, or use the Wakhan to enter China, analysts say.
For Uighur militants in Syria, the real enemy is China
China collects DNA from Muslim-majority population in Xinjiang
China's crackdown on Uighur Muslims has turned Xinjiang into a 'police state'
Afghan and Chinese officials discussed the plan in December in Beijing, but details are still being clarified, Afghan defence ministry deputy spokesman Mohammad Radmanesh said.
"We are going to build it [the base] but the Chinese government has committed to help the division financially, provide equipment and train the Afghan soldiers," he said.
A senior Chinese embassy official in Kabul would only say Beijing was involved in "capacity-building" in Afghanistan.
Nato's US-led Resolute Support mission in Afghanistan declined to comment. But US officials have previously welcomed China's role in Afghanistan, noting they share the same security concerns.
Members of the Kyrgyz ethnic minority in Wakhan told AFP in October they had been seeing Chinese and Afghan military patrols for months.
"The Chinese army first came here last summer and they were accompanied by the Afghan army," said Abdul Rashid, a Kyrgyz chief, adding that he had seen vehicles flying Chinese flags.
The Afghan army arrived days earlier "and told us that the Chinese army would be coming here", he said, adding: "We were strictly told not to go near them or talk to them and not to take any photos."
Mr Rashid's account was confirmed by other Kyrgyz, including another chief Jo Boi, who said the Chinese military spent almost a year in Wakhan before leaving in March 2017.
Both Chinese and Afghan officials deny the claims, with China's defence ministry telling AFP that the "Chinese army is not engaged in any military operation in the Wakhan Corridor".
With little access to the corridor, Kabul provides almost no services to those who live there - but the Chinese, Mr Boi said, have been bringing "a lot of food and warm clothes".
"They are very good people, very kind," he said.
After their March visit, he said, they returned in June for roughly a month. "Since then they come every month ... to distribute food."
China fears militancy could threaten its growing economic interests in the region, said Ahmad Bilal Khalil, a researcher at the Kabul-based Centre for Strategic and Regional Studies.
"They need to have a secure Afghanistan," he said, estimating Beijing had provided Kabul with more than US$70 million (Dh257m) in military aid in the past three years.
It recently flagged the possibility of including Afghanistan in the $54 billion China-Pakistan Economic Corridor (CPEC) linking western China to the Indian Ocean via Pakistan.
"The anti-terrorism motivation is an important one but it's not as important as the bigger move to boost the CPEC," said Willy Lam, a political analyst in Hong Kong.
Kabul is also keen for Beijing to have a "more active role", said Andrew Small, author of The China-Pakistan Axis.
It hopes China will use its "special relationship" with Islamabad to encourage the Pakistani military, who wield significant influence over Afghanistan's insurgents, to "force the Taliban into peace talks", Mr Small said.
"In the end China has vastly greater financial power than anyone else. So having them engaged ... may end up being critical to the country's basic economic viability," he said.