Afghan President Ashraf Ghani arrived in China on Tuesday for four days of meetings aimed at strengthening ties between the two countries. The visit emphasizes Afghanistan’s need to shore up dwindling foreign investment and China’s interest in leveraging expanded economic cooperation with Kabul to ensure regional stability as NATO forces depart.

On the first day of his first state visit since becoming Afghanistan’s new leader last month, Ghani met with his Chinese counterpart, President Xi Jinping, in a ceremony announcing closer economic and security cooperation. “We feel that our vision of Afghanistan as a hub of regional trade, transit and peace would be an illustration of your vision of East Asia and South Asia cooperation,” Ghani said. Xi, meanwhile, called for “a new era of cooperation in China-Afghanistan relations” to “take development to a new depth and breadth.”

For Afghanistan, the visit highlights the nation’s stark economic picture and uncertain future. As the 13-year war de-escalates, Afghanistan’s economic growth is stalling at 1.5 percent, according to World Bank figures. With his China visit, Ghani, a former World Bank economist who made a career creating state-building institutions in poor countries, hopes to change that. At the heart of a stronger economic relationship is one of the world’s most valuable untapped mineral deposits, which include large quantities of copper, iron and ore.

A recent U.S. geological survey estimated that Afghanistan’s untapped mineral wealth could exceed $1 trillion thanks to a massive deposit said to include copper, iron, cobalt, ore and other rare earth metals. An assessment by the Afghan government has put the number of estimated mineral wealth as high as $3 trillion.

In 2007, two of China’s state-owned enterprises initiated a $3 billion deal to develop one of Afghanistan’s untapped mineral sites, a 5 million-ton copper deposit at Mes Aynak, about 20 miles outside Kabul. The project, undertaken by Metallurgical Company of China and the Jiangxi Copper Corporation, has been plagued delays. Last year, China removed its workers after attacks by the Taliban – a force Beijing does not want to see encouraging Muslim separatist groups its western Xinjiang region.

But the deal remains the cornerstone of China’s investment in Afghanistan, and it is expected to play a major role in the expanded economic link between the two countries. Beijing and Kabul already have an energy partnership. In 2012, the China National Petroleum Company secured rights to develop oil fields in the Amu Darya basin, in Afghanistan’s north.

Afghanistan, in turn, hopes to secure a transportation link between the two countries, which are separated by a 47-mile strip of sparsely populated land known as the Wakhan Corridor.

Clues to how all this may play out emerged in the terms of the agreement signed Tuesday. China will provide grants of more than $300 million over the next three years. That’s more than all the economic assistance Beijing has provided Kabul since the overthrow of the Taliban in 2001.

For Afghanistan, this represents a needed source of revenue in a country that has remained an economic castaway after years of aid from the international community.

For China, the commercial ties are not just business opportunities. They also represent part of a broader strategy to help keep stability in a region marked by volatility.

“Its [China’s] principal assets are economic and diplomatic,” writes Andrew Small [PDF], an analyst with the German Marshal Fund who specializes in China's role in “problem” and fragile states. “The troubles of investing in Afghanistan, however, pale into insignificance by comparison with Beijing’s broader concerns about the future of the region. While China certainly wished to see an end to the presence of Western troops, it is contemplating with mounting concern the fact that it will no longer be able to rely on the Europeans and Americans to contain the worst of the potential outcomes after 2014.”

Chinese leaders are acutely aware of the prospect of a failed state or a civil war on its borders, especially given Chinese concerns about its western Xinjiang province, where Beijing fears separatist ambitions from ethnic Uighurs, a Muslim minority in the country.

China has blamed a spate of recent public attacks on Uighur separatists, though critics of Chinese policy believe the fear is exaggerated and the crackdown unjust. On Tuesday, Ghani pledged symbolic support, saying Afghanistan stood with Beijing against Uighur separatists.

China’s slow ramping up of interests in Afghanistan is consistent with a broader push into the rest of Central Asia, where it has made investments across energy and infrastructure sectors in a number of former Soviet republics in recent years. And while Beijing has been cautious about getting involved with Afghanistan given poor security, its diplomatic footprint in the country has slowly dovetailed with its economic interests.

In June 2012, the Shanghai Cooperation Organization (SCO), a regional security body led by China, granted Afghanistan full observer status for the first time. Since then, while the SCO has not agreed to any consensus position on stabilizing Afghanistan, Beijing has tried to solidify its diplomatic clout. On Friday, Ghani will attend the Istanbul Ministerial Process, a regional body set up to help Afghan development, which China is hosting for the first time.

Raffaello Pantucci, a senior research fellow at the Royal United Services Institute, writes, “A stable Afghanistan is in China’s national interest, and taking the lead on this regional issue of international importance could help bolster Beijing’s global position.”

With wire services