ISLAMABAD: The spy agencies of Pakistan and Afghanistan have agreed to share intelligence and bolster cooperation in their fight against the Taliban, the latest sign of a thaw in once-frosty ties.

But the deal announced on Monday triggered uproar in the Afghan parliament and an avalanche of criticism on social media, with many accusing President Ashraf Gani’s government of selling out to longtime nemesis Pakistan.

Pakistan’s Inter-Services Intelligence (ISI) and Afghanistan’s National Directorate of Security (NDS) have signed a memorandum of understanding, Pakistan army spokesman Major General Asim Bajwa said on Twitter.

The agreement “includes international sharing, complementary and coordinated intelligence operations on respective sides”, Bajwa said, without specifying when and where the MoU was signed.

Pakistan has a civilian government but the military and ISI still wield great influence, particularly over policy towards neighbouring Afghanistan.

Afghan officials have frequently accused Pakistan of harbouring and nurturing Taliban insurgents, who are waging a 13-year war against local and foreign troops in the country.

But Ghani has actively courted Pakistan since coming to power in what observers say is a calculated gambit to pressure the insurgents to the negotiating table.

“We cannot sign a MoU ... with those who kill our people. Our government should not be that reckless,” said Afghan lawmaker Shukria Barakzai after the announcement sparked uproar in parliament on Monday.

“Instead of strengthening its security infrastructure the government is signing an MoU with the enemy of Afghanistan.”

But the Afghan government played down the significance of the deal.

“The new MoU is about exchanging tactical information on threats for both spy agencies. Reports saying the ISI will be training or equipping the NDS are false,” said NDS spokesman Hasseeb Sediqqi.

Sediqqi said similar MoUs had been signed in 2006 and 2009 but “they did not achieve the desired result”.

Afghanistan’s engagement with Pakistan in its fight against the Taliban is seen as a major policy shift from the previous Hamid Karzai government, which accused Islamabad of destabilising Kabul.

Pakistan Prime Minister Nawaz Sharif pledged support to Afghanistan in combating the Taliban during a visit to Kabul last week, signalling improving ties.

Sharif’s visit, his first since President Ashraf Ghani came to power in September, came as concerns grow over an upsurge in Taliban-led violence in Afghanistan.