ISLAMABAD, Pakistan — ISIS fighters exporting their deadly ideology have forced rivals Iran and Pakistan into a tentative terror-fighting partnership.
The national security czars of both Iran and Pakistan met in Tehran on July 24 to discuss "the need to fight against the common threat posed by … ISIS" and announced they would come together to police their 600-mile border.
The shared regional threat was underscored Tuesday when dozens were killed in a suicide bombing at a hospital in the southwestern Pakistani city of Quetta. ISIS was one of two groups to issue competing claims of responsibility.
Since surging into the international spotlight by capturing swathes of Syria and Iraq in the summer of 2014, ISIS has sprouted several regional branches outside of their initial heartland.
One branch — dubbed the province of Khorasan — has killed hundreds in Afghanistan, including a July 23 attack in Kabul that killed 81 and injured 237.
The Pentagon said Friday that a U.S. drone strike had killed the leader of ISIS's branch in Afghanistan, though he's been reported dead before.
It comes amid mounting fears that ISIS is expanding its operational reach.
While all countries in the region are vulnerable, ISIS poses a particular threat to Iran, according to Dina Esfandiary, a MacArthur fellow and researcher at King's College London.
"Iran is the country in the region that feels the ISIS threat most acutely," she said.
One reason for that is because Iran is largely Shiite and ISIS is a Sunni fundamentalist organization whose goal is to eradicate Shiite Islam altogether, according to Esfandiary.
That's why Iran — which is fighting ISIS on its western border in Iraq as well as in Syria, where it is supporting the embattled government of President Bashar Assad — is "throwing everything it can at the problem," she explained.
Iran-Pakistan: New friends or old Frenemies?
The rare meeting between Pakistan's national security adviser, retired Lt. Gen. Nasser Khan Janjua, and Secretary of the Iranian National Security Council, Ali Shamkhani, indicates the countries are now willing to work together after years of mistrust.
Both countries have been accused of sheltering or supporting militants fighting proxy wars in the other. India and Iran’s close relationship angers Pakistan — Delhi is Islamabad’s arch rival. Meanwhile, Pakistan’s strong bond with Saudi Arabia makes Iran suspicious given its struggle with the Kingdom for regional dominance.
Iran has gone after al Qaeda members — but also been accused of housing the group’s leaders and members of Osama bin Laden's family members following the Sept. 11, 2001 attacks on the U.S.
Pakistan also has a complex relationship with al Qaeda, though is widely believed to have sheltered members of that group, plus Afghan Taliban fighters and commanders.
Then there's Afghanistan — which lies between the two and where both have meddled for decades.
While any plans between Iran and Pakistan to confront ISIS are vague, their cooperation on the issue is much needed and long overdue, said Hussain Haroon, Pakistan’s former envoy to the United Nations.
"This one statement is a ray of sunshine after a very long time in Pakistan’s foreign policy,” he told NBC News. "A lot of our international play has been curtailed due to us looking at Saudi Arabia, and what has that given us?"
“It was inevitable. Now that the Taliban is kind of cornered in Afghanistan, and Pakistan stands isolated regarding its support for the Taliban, and then ISIS is emerging, we need to work with the Iranians,” he added.
Not everyone, though, is impressed by the promise of cooperation — certainly not an Afghan commander of a brigade in western Afghanistan near Iran who has been fighting insurgents for 12 years.
"I don't think they are being sincere in what they say,” he said speaking on the condition of anonymity because he is not authorized to speak to the press. "Both countries provide arms and sanctuaries for terror groups and now they are saying they want to fight ISIS."
Maj. Najibullah, the commander of a police unit in northeastern Afghanistan's Kapisa Province, agreed.
"We can never trust Pakistan or Iran," said Najibullah, who like many Afghans goes by only one name. "They have been saying that they are fighting terrorism for the past 15 years but we see it every day that they are supplying these groups and every other few months they create a new group for us.”
Afghan officials would not comment on the Iran-Pakistan agreement.
Esfandiary also advised caution around the new Pakistan-Iran pact.
Pakistan and Iran "met to discuss terrorism broadly and made some general statements about it," she said. "When you look into the statement that they made the only thing they agreed to concretely is boost border security — it is very limited in terms of actual steps to to work together."
"It looks good, it is signaling [but] making statements and actually tackling the threat are two different things," she added.
That doesn't mean there isn't optimism in Pakistan about the move towards cooperating with Iran — and hopes that it'll extend beyond fighting terrorists.
Air Vice Marshal Shahid Latif, a security analyst and a lecturer at Pakistan's National Defense University in Islamabad, said it’s high time his country started working with Iran.
“Trade, energy and lot of other causes are bringing Iran and Pakistan potentially together,” he said. "Forget who did what to whom in the past. If Pakistan and Iran can coordinate, we could even involve Afghanistan and fight this menace together."