Image copyright Getty Images Image caption Most Nato forces will withdraw from Afghanistan in December, leaving 9,800 US troops behind

China is emerging from the shadows to pledge to play a major role in peacemaking in Afghanistan as foreign troops prepare to withdraw at the end of the month, writes guest columnist Ahmed Rashid.

Beijing's efforts include an invitation for the Taliban to visit China.

Yet sceptics may well ask whether China, which has never played such a mediating role outside its borders before, can succeed where the US, Nato and Afghanistan's neighbours have so far failed.

''For the past 13 years the US and Nato have been playing a major role in Afghanistan and we made a contribution and gave them support - but now with the US leaving, Afghanistan is facing a critical period,'' Ambassador Sun Yuxi, China's special representative for Afghanistan and Pakistan, told the BBC.

In his first interview to Western media, Ambassador Sun said: ''We are ready to do more, we want to play a bigger role.

"We would welcome the Taliban in any neutral venue such as in China. We will make negotiations happen but the process must be Afghan-owned and Afghan-led - the agenda must be proposed by President Ashraf Ghani,'' he added.

Facilitating talks

President Ghani has already visited Beijing to ask the Chinese to play just such a mediating role and to put pressure on Pakistan, which is a close ally of China, to let the Afghan government meet with Taliban leaders living in Pakistan.

Islamabad's powerful military, which takes all major foreign policy decisions, has indicated it is willing to consider a peace process once the Afghans come up with one.

Image copyright Getty Images Image caption Afghan President Ashraf Ghani paid a landmark visit to China in October

Ambassador Sun said that China had already established several forums for discussion on how to bring in neighbouring states and others to support reconciliation in Afghanistan.

''One tripod involves talks between China, Afghanistan and Pakistan, the second is a group of regional countries called 'six plus one', which involves US, Russia, China, India, Pakistan and Iran and the one being Afghanistan. This group has already met twice,'' said Mr Sun.

Another 'tripod' group that Western diplomats say has held several meetings, but which the Chinese are reluctant to talk about, is China, US and Afghanistan.

This grouping is seen to be especially vital as the US withdraws from Afghanistan. The Chinese have said they will never deploy troops in Afghanistan, but they are certain to become the major power in the region.

The US, which is undergoing a strategic shift away from the Pakistan-Afghanistan region, is not averse to a larger Chinese role if it involves keeping the peace and keeping out the militants.

'Terrorism' threat

The international forums being sponsored by the Chinese are trying to achieve multiple aims - to support reconciliation in Afghanistan, but to bring countries like India and Pakistan and Iran and Pakistan to the table to iron out their mutual rivalries which have stymied every peace process in Afghanistan since the 1980s.

The appointment of Sun Yuxi, 63, who has specialised in Afghanistan since 1981 when as a young diplomat he helped provide Chinese arms to the Afghan mujahideen fighting the Soviets, is a strong signal that China is serious.

Fluent in English, articulate and friendly Mr Sun is clearly equipped with extraordinary powers from his leaders to make things happen.

Image copyright Getty Images Image caption Ambassador Sun Yuxi says any peace talks with the Taliban must be led by the Afghans

The reasons for this diplomatic outing by China, when it has never helped mediate an international conflict before, is the risks it faces from the south.

Cheap Afghan opium is flooding China while Uighur Islamic extremists from Xinjiang have been accused of carrying out acts of terrorism. Hundreds of them are based in the badlands of Pakistan and Afghanistan and are supported by the Taliban and al-Qaeda.

In fact China faces an increasing national security threat if militant groups continue to find sanctuary in Afghanistan and Pakistan.

''We support a peace process because we are also victims of terrorism,'' says Mr Sun.

Rebuilding north-south corridor

''Our larger strategy is also economic development - the construction of the Silk Road which includes Pakistan and Afghanistan,'' said Ambassador Sun.

China is investing billions of dollars in a road and rail transportation network that will stretch from western China to Germany crossing dozens of countries.

Afghanistan, rich in minerals and oil that China is keen to exploit, is a critical part of that network.

China wants to build a north-south economic corridor through Pakistan that would carry energy from the Gulf to the Chinese border nearly 2,000 miles in the north.

China's funding of such mammoth projects could become a huge lure for Pakistan, Afghanistan and the Taliban to come to the peace table.

Diplomats describe it as a once-in-a-lifetime opportunity to kick-start the two redundant economies of Pakistan and Afghanistan.

Image copyright Getty Images Image caption China wants to help rebuild Afghanistan's economy and in turn benefit from its wealth of minerals and oil

More than $100bn (£64bn) will be involved in building the Afghan and Pakistani spurs of the Silk Route.

China wants to exploit the mineral deposits of Afghanistan and is prepared to build a railway from Kabul to Xinjiang in China, while similar mammoth schemes are being prepared for Pakistan.

But nothing will happen until the numerous wars in the region come to an end. That includes the insurgency in Balochistan, the violence in Karachi and the Taliban insurrections in Pakistan and Afghanistan.

Much will depend on whether the Pakistan army is prepared to seize the moment and push the Afghan Taliban to the peace table.

Diplomatic sources say the Chinese have already established their own contacts with the Taliban.

However, China is unlikely to get itself involved in the nitty-gritty gritty of peace talks between President Ghani and the Taliban.

It wants to make the introductions, provide a neutral venue and let the two sides get on with it, which is why China is now anxiously waiting for a peace plan from Ashraf Ghani and support from Pakistan's military.

Ahmed Rashid