The most important message of India for Afghanistan is that it is not leaving, and it is backing that message with the biggest aid package it has ever given another country.

Indian diplomats insist the message is meant as reassurance for allies in Afghanistan nervous about waning international support as NATO withdraws its troops. Yet it could equally have been chosen to send a warning to Pakistan.

The nuclear-armed neighbors both want to secure influence in Kabul after foreign combat forces leave this year, and both are using aid as part of their strategy.

India’s $2 billion aid package includes several big projects, including a white marble parliament in Kabul that is rising up next to the blasted ruins of the old king’s palace.

Relations between Afghanistan and Pakistan are rockier. Afghan President Hamid Karzai regularly accuses Pakistan of supporting Taleban, and has curtly made clear he cares more about security than Pakistani aid.

Some Afghans fear that the regional rivalry might drag their country into a proxy war. “This is a very sensitive situation. Both are powerful, important allies,” said Senator Arifullah Pashtoon, chairman of Afghanistan’s foreign relations committee.

“India is our friend. But Pakistan is our twin.”

With the NATO withdrawal looming, Afghanistan has increasingly sought Indian military assistance, while Pakistani offers of military help have largely been snubbed.

Indian engineers have built power lines from Uzbekistan to Kabul — on time and $20 million under budget — and a road to Iran, now pockmarked by bomb blasts, designed to break landlocked Afghanistan’s dependence on Pakistani ports.

For wells, schools and clinics, India simply pays the Afghan government to build them and report back.

Pakistan has also ramped up its aid. When Karzai visited Islamabad last year, Prime Minister Nawaz Sharif announced an increase in total aid from $385 million to $500 million and enthused about roads, railways and medical centers.

When Karzai took the microphone he responded sourly: “The primary concern is lack of security ... and the continued menace of terrorism.”

Pakistan insists it is doing all it can to help Kabul, including sheltering three million Afghan refugees.

But suspicion dogs their relationship, with Karzai accusing Pakistan of harboring Afghan Taleban and other militants.

Pakistan denies such charges and accuses others of the same game. Some in Islamabad are convinced Afghanistan is nurturing factions of the Pakistani Taleban for future leverage.

Pakistani officials also suspect India of secretly fomenting a separatist rebellion in Balochistan province.

Pakistan’s powerful military is wary: Its worst nightmare is a hostile India on Pakistan’s eastern flank and an unfriendly Afghanistan backed by India to the west.

As NATO’s presence fades, Karzai is turning to India. More than 650 Afghan officers and members of its special forces have been trained in India. Now he wants tanks, mortars, field guns and aircraft.

While India has been wary of supplying weapons or sending trainers to Afghanistan because it does not want to provoke Pakistan, that may change after India’s election.