BEIJING — No stranger to engaging in power politics with its Asian neighbors, China’s diplomatic corps has in recent months been trying on a new role: talking with the Afghan Taliban in an effort to play peacemaker.

Late last year, two Afghan Taliban officials traveled with Pakistani officials to Beijing to discuss a potential peace process among Afghanistan’s warring parties, according to three current and former Afghan officials. And that may not have been the first such meeting. Though his account could not be independently confirmed, one Pakistani journalist said that China’s special envoy to Afghanistan, Sun Yuxi, had traveled to Peshawar, Pakistan, to meet with Afghan Taliban representatives weeks earlier.

Despite years of war and turmoil in Afghanistan, China had long seemed reluctant to become directly involved. So what has changed to move it to try to mediate with Islamist militants now? According to Chinese and foreign analysts, the answer lies in three factors: China’s growing worries about a Uighur uprising on its own frontier; concern about more instability on its western border after the main American troop withdrawal from Afghanistan; and urgency to secure access to Afghan mineral and oil deposits where Chinese companies have already made large investments.

“Under the new situation, China is more willing to take on greater responsibility and more willing to proactively promote conciliation,” said Zhao Huasheng, a professor and director of the Center for Russian and Central Asian Studies at Fudan University in Shanghai.