India's decision to underwrite and, in effect, guarantee Hamid Karzai's feeble Afghan government is not wholly lacking in logic. In a strategic pact signed on Tuesday, the two countries pledged to co-operate on trade and counter-terrorism, and Delhi agreed to train and equip Afghan security forces. With US and Nato forces edging towards the exit in 2014, it follows that Delhi, the region's military and economic heavyweight and an aspiring superpower, should take up the strategic slack. But that is not how Pakistan or the Taliban will see the newly announced bilateral security, political and commercial "partnership". India may yet pay heavily for its presumption.

India's role, or "meddling", in Afghanistan is already viewed with enormous suspicion in Islamabad, which nurtures a visceral fear of encirclement arising from its bruising, losing wars with its far larger southern neighbour. Pakistan privately regards Afghanistan as its own backyard, to such an extent that it is widely believed to fund and collude with terrorist groups such as the Haqqani network in order to maintain its influence and keep the Kabul government weak and off-balance.

"Pakistan has pursued a double game toward Afghanistan, and using terrorism as a means continues," Karzai complained this week before travelling to India. Pakistan – or at least elements of its security and intelligence services – has been accused by Kabul of complicity in last month's murder of Burhanuddin Rabbani, the former Afghan president and peace talks negotiator. India, meanwhile, has detected Pakistan's hand in the bombing of its Kabul embassy in 2008 and again in 2009, as well as terrorist attacks on Indian soil. Pakistan denies all the allegations.

Demonstrating that he, too, can play both sides against the middle, Karzai offered reassurances on Wednesday that the partnership deal with India was not aimed at Islamabad. "Pakistan is a twin brother, India is a great friend. The agreement that we signed yesterday with our friend will not affect our brother … the signing of the strategic partnership with India is not directed against any country. It is not directed against any other entity. This is for Afghanistan to benefit from the strength of India," he said.

Karzai's attempt to sweeten the pill may also reflect his desire to keep open the possibility of a negotiated settlement with the many-headed Taliban despite Rabbani's death and the continuing insurgent violence. The Taliban will not have forgotten India's backing of the non-Pashtun Northern Alliance in the 1990s, which eventually swept them from power in 2001 with US help. The idea of India playing an enhanced security role inside Afghanistan, as agreed in Delhi this week, is thus likely to be rejected by them as more unwelcome foreign interference. Karzai noted bitterly last week that if peace were ever to come to Afghanistan, his government needed to talk to Pakistan, not India or the US.

India has been expanding its involvement in Afghanistan since 2001, opening provincial consulates, embarking on road and infrastructure programmes, and donating about $2bn in bilateral aid. But this week's agreement represents a substantial and risky increased commitment. Nobody in Delhi is talking about Indian troops or security forces on the ground in Afghanistan. But the Afghan forces training role India has accepted marks it out as Nato's successor, and potentially a target for insurgent wrath.

Manmohan Singh, India's prime minister, seemed to brush aside such concerns when he met Karzai. "Our co-operation with Afghanistan is an open book. We have civilisational links, and we are both here to stay … India will stand by the people of Afghanistan as they prepare to assume responsibility for governance and security after the withdrawal of international forces in 2014," Singh said. These are fateful words. They may come back to haunt the Indians once the Americans have gone.

Given the rapid fraying of US-Pakistani relations since the discovery earlier this year of Osama bin Laden living in a Pakistani garrison town, and given the deep unpopularity of the Afghan war at home, Washington is doubtless quite happy to let its bumptious new ally India pick up the challenge of preventing Afghanistan slipping back into civil war. It enables Barack Obama, or his successor, to claim that the war was not in vain and has been followed through with a regionally guaranteed settlement.

India's leaders one day may come to rue their vainglorious generosity in picking up the hot potato that the US, Britain and the rest all gingerly dropped. It seems a high price to pay for outflanking Pakistan.