Pakistan's ally China says it is 'deeply shocked' by a cross-border attack by Nato forces in Afghanistan that killed 24 Pakistani soldiers Reuters

China has stepped into the toxic diplomatic dispute between Pakistan and the United States, expressing its "deep shock and strong concern" over the deaths of Pakistani soldiers bombarded by Nato helicopters at a border post.

The intervention by the Chinese foreign ministry comes at a time when relations between the US and Pakistan are at their most strained for many years. It is being seen as a move by Beijing to strengthen its already close ties with Islamabad in the wake of Saturday's air attack in which 24 Pakistani soldiers died.

The prime minister of Pakistan, Yousaf Raza Gilani, has threatened to "revisit" engagement with Nato following the deaths at the Mohmand border post, the deadliest such incident since the start of the Afghan war in 2001. "Business as usual will not be there," Gilani told CNN .

Pakistan has suggested it may now boycott the 5 December international conference on Afghanistan's future at Bonn, in Germany.

China's comments were the product of a 40-minute conversation between the Chinese foreign minister, Yang Jiechi, and his opposite number in Pakistan, Hina Rabbani Khar. After the exchange, the Chinese foreign ministry said that "China is deeply shocked by these events, and expresses strong concern for the victims and profound condolences to Pakistan".

A foreign ministry spokesman added: "China believes that Pakistan's independence, sovereignty and territorial integrity should be respected and the incident should be thoroughly investigated and be handled properly."

The border incident has thrown the coalition strategy in Afghanistan into crisis. The Pakistan military insists the attack on the checkpoint was "unprovoked" and that it lasted for two hours, even though Pakistani forces had contacted Nato, pleading for the firing to stop. Afghan officials continue to claim that the airstrikes were called in after they came under fire first from the Pakistani side of the border.

On Saturday, Pakistan closed the border for supplies to Nato troops in Afghanistan. There is no indication when the border crossing will be reopened. Half the supplies to coalition soldiers pass by land through Pakistan, including most of the fuel supplies, using local transport companies. , the All Pakistan Oil Tanker Owners Association said it would only resume transport if Islamabad and the Pakistani military accepted an apology for the incident.

The Chinese intervention carries a significance beyond the immediate dispute. Islamabad considers Beijing to be its closest ally and an alternative partner to the west, while both governments oppose US plans to have bases in Afghanistan beyond the 2014 date for ending the coalition's combat operations there.

Coincidentally, Pakistan and China began a joint military exercise in Punjab province involving about 500 soldiers and designed to show, as the Pakistan army put it, that the "Pakistan-China friendship is higher than the mountains and deeper than oceans". It was the fourth military collaboration between the two countries since 2004.

The former spokesman for the US state department, PJ Crowley, who now holds a professorship at Dickinson college and Penn State school of law, said China was seizing the moment. "China sees this as a target of opportunity, both to tweak the US and to subtly suggest to Pakistan that if it really sours of its relationship with the US, it has an alternative."

As US diplomats struggle to limit the damage from Saturday's events, much will depend on the outcome of the investigation Nato has promised into the airstrike. The inquiry is likely to be led by a senior US officer.

The focus of the investigation will be on the poorly marked border between the Afghan province of Kunar and Mohmand. Coalition and Afghan troops believe they received fire from insurgents operating from close to the Pakistani post, which is located 300 metres into Pakistani territory.

Pakistan says there were no militants operating on its side.

A senior Afghan official told the Guardian that a combined Afghan-Nato squad had received incoming fire from "the so-called Pakistani post", prompting them to call for air support. "The most important point here is that they were receiving fire from the direction of that post."

The official, who did not want to be named, added: "The Pakistanis are blowing this thing totally out of proportion by responding the way they have, so severely and strongly. But we hope that they will at least come to Bonn and it will not affect the steps that we have started to take in terms of rebuilding our relationship with Pakistan."

Afghan and coalition officials have accused Pakistan repeatedly in the past of failing to act to stop Taliban militants using its territory.

Afghans living in Kunar said they were delighted by the airstrike against the bases, saying they believed Taliban fighters were being harboured by the Pakistani army.

"These terrorists wear civilian clothes and then when they have done their attacks in Afghanistan they go to the Pakistan checkpoints," said Qari Ehsanullah Ehsan, a tribal leader from the province. "Some of them wear fake beards and then put on Pakistani military clothes when they finish their operations. The people of Kunar are happy. We have been telling the Americans for a long time that the Pakistanis are bringing the Taliban to our villages."

The fall-out from the attack continued to reverberate around the region.

On Monday, the Organisation of the Islamic Conference also condemned the attack on the checkpost, while over the weekend Turkey promised to raise the issue at Nato headquarters in Brussels.

There were further protests on the streets of Pakistan on Monday, including a boycott of the courts by lawyers. The striking lawyers in Karachi and Lahore chanted "Go America, go".