If there were any doubts about China’s intent to keep ties close with its all-weather ally Pakistan, Beijing demolished them with a reported US$2 billion loan just days after the election of a new Pakistani premier.

While cricketing legend Imran Khan attempts to form a coalition government, China has stepped up to reinforce a geopolitical alliance that shapes the South Asian nation’s policies towards the US and India. The announcement caused Pakistan’s rupee to jump the most in nearly a decade as Khan takes power with an economy in chaos.

The gesture speaks to Pakistan’s overwhelming reliance on China as a source of financial, diplomatic and military support at a time when US President Donald Trump has cut military aid to Islamabad.

Ultimately, Khan may not have a choice. Pakistan’s powerful military has continued to push its civilian counterparts for close ties with China to ensure the flow of more than US$60 billion in loans for the China-Pakistan Economic Corridor (CPEC) infrastructure projects.

“There is a deep, far-reaching political consensus in Pakistan for a continued strong partnership with Beijing,” said Michael Kugelman, a senior associate for South Asia at the Woodrow Wilson Centre in Washington. “This is especially true now, with Pakistan’s relationship with America facing an uncertain future.”

Khan and his Pakistan Tehreek-e-Insaf, or Movement for Justice, party won the most seats in an election last week that was marred by allegations of military interference. Like China, Khan acted quickly to send a public message.

“Our neighbour is China, we will further strengthen our relations with it,” Khan said as he declared victory in a televised statement. “The CPEC project which China started in Pakistan will give us chance to bring in investment to Pakistan.”

Speaking at a press briefing on July 30, Geng Shuang, a spokesman for China’s foreign ministry said China welcomed the new government. Khan “is likely to try to balance the US and China, but China and Pakistan are mutually dependent”, said Wang Yiwei, director of Renmin University’s Institute of International Affairs in Beijing. “He won’t be able to change that.”

While China was initially focused on former premier Nawaz Sharif’s Pakistan Muslim League-Nawaz, Beijing had “diversified its contacts and investments” in Pakistan, said Dhruva Jaishankar, a foreign policy fellow at Brookings India.

At the same time, Pakistan’s military, which has ruled the country outright for much of its 71-year history, defines the country’s policy towards CPEC projects.

Khan “does not have a lot of wiggle room”, Jaishankar said. “We may continue to see a gradual trend of Pakistan drifting closer to China and more distant from the United States. But that would have to do with a number of factors beyond Imran Khan’s election.”

Indeed, the political consensus on China is especially important now, said Kugelman. “Pakistan needs powerful friends, and China is one of the few that Islamabad can depend on – Khan knows this, and he’ll do what’s necessary to ensure that the China-Pakistan relationship remains strong,” he said.

One of the most crucial tasks ahead of Khan is Pakistan’s ailing economy, which analysts say is likely to push Pakistan towards yet another International Monetary Fund bailout.

Over the weekend, Karachi’s Express Tribune newspaper, citing unnamed finance ministry officials, reported that Beijing authorised a US$2 billion loan to help Islamabad weather the economic crisis. The Islamic Development Bank, a multilateral lender based in Saudi Arabia, also activated a three-year US$4.5 billion oil-financing loan, the report said. A finance ministry spokesman did not respond to calls or messages seeking comment on Tuesday.

The amount of Chinese loans given to Pakistan over the past 13 months alone comes close to the IMF’s last loan of US$6.2 billion. Those vast debts to China have prompted worries from US Secretary of State Mike Pompeo, who said he would be watching to see if Khan’s new government used IMF funds to pay off Chinese loans.

“We want the US to see our ties without mixing it up with China,” Fawad Chaudhry, a spokesman for Khan’s party, said on Wednesday. “We haven’t yet taken a final decision to go to the IMF, though we hope the US won’t hinder if we seek the fund’s support.”

The new Chinese loan would help Pakistan shore up falling foreign exchange reserves, said Najam Rafique, director of the Islamabad-based Institute of Strategic Studies. Khan leans towards boosting ties with China, he said.

“China isn’t a distant power, it’s a neighbour.” Khan “will be trying to improve and build upon what’s already in process”.