An Iranian strike on Pakistan this week that drew a rapid military riposte and raised fears of greater regional turmoil was driven by Iran's efforts to reinforce its internal security rather than its ambitions for the Middle East, according to three Iranian officials, one Iranian insider and an analyst.
Both the heavily-armed neighbours, oftentimes at odds over instability on their frontier, appear to want to try to contain the strains resulting from the highest-profile cross-border intrusions in recent years, two analysts and two of the officials said.
Iran sent shockwaves around the region on Tuesday with a missile strike against what it described as hardline Sunni Muslim militants in southwest Pakistan. Two days later, Pakistan in retaliation attacked what it said were separatist militants in Iran - the first air strike on Iranian soil since the 1980-88 Iran-Iraq war.
Tuesday's strike was one of Iran's toughest cross-border assaults on the Sunni militant Jaish al-Adl group in Pakistan, which it says has links to Islamic State. Many of Jaish's members previously belonged to a now-defunct militant group known as Jundallah that had pledged allegiance to Islamic State.
The move deepened worries about Middle East instability that have spread since the Israel-Hamas war erupted in October. Iran-allied militias from Yemen to Lebanon have launched strikes on U.S. and Israeli targets, including on Red Sea shipping, in sympathy with Gaza's Palestinians.
It also came a day after Iran launched attacks in Iraq and Syria, which it said targeted Israeli espionage and Islamic State operations, respectively.
But the tit-for-tat blows between Iran and Pakistan occurred far from that war zone, in remote borderlands where separatist groups and Islamist militants have long carried out attacks on government targets, with officials in Pakistan and Iran often accusing each other of complicity in the bloodshed.
Gregory Brew, an analyst at Eurasia Group, an international risk consultancy, said Tehran's strikes were motivated in large part by Iran's rising concerns about the threat of domestic militant violence in the wake of a deadly Jan. 3 bombing claimed by the Islamic State group.
"There's a lot of domestic pressure to 'do something,' and the leadership is responding to that pressure," he said.
Spokespeople for the Iranian and Pakistani foreign ministries could not immediately be reached for comment.
'CRUSHING RESPONSE'
Pakistan recalled its ambassador from Iran in protest at Tuesday's attack. For its part, Tehran strongly condemned Pakistan's strikes on Thursday, saying civilians were killed, and summoned Pakistan's most senior diplomat in Iran to give an explanation.
But in their statements, neither government sought to make a link to the Gaza war or to attacks carried out in support of Palestinians by a network of Arab militias allied to Iran from the Mediterranean to the Gulf.
In a public statement on Thursday, the foreign ministry in Tehran said: "Iran considers the security of its people and its territorial integrity as a red line" and expects "friendly and brotherly" Pakistan to prevent armed militant bases on its soil.
For Iran, the trigger for the flare-up was a devastating bombing on Jan. 3 that killed nearly 100 people at a ceremony in the southeastern city of Kerman to commemorate commander Qassem Soleimani, who was killed by a U.S. drone in 2020.
Soleimani, architect of Iran's drive to extend its influence across the Middle East, was a hero to supporters of the hardline establishment. Tehran publicly vowed revenge against Islamic State, the ultra-hardline Sunni Muslim militant group that claimed responsibility for the bombing.
An Iranian insider close to the country's ruling clerics described the Kerman bombing as "an embarrassment for the leadership" that had shown Iranian security to be vulnerable.
Tuesday's strike was aimed at demonstrating the security organisations' capabilities amid concern among Iranians about a lack of security in the country, the Iranian insider said.
"Such terrorist attacks will get a crushing response from Iran," the insider said.
Iran has also arrested dozens of people linked to Islamic State.
On Tuesday, Iranian missiles struck two bases of the Sunni Muslim group Jaish al-Adl (or the Army of Justice) in Pakistan's southwestern province of Balochistan, which borders Iran. The group's ultra-hardline Sunni Islamist militancy is seen as a threat by Iran, primarily a Shi'ite Muslim country.
A senior Iranian security official told Reuters that Iran had provided Pakistan with evidence that Jaish al-Adl was involved in the Kerman attack, coordinating its logistics, and had asked Pakistan to act against it. Iran had obtained evidence that members of the group were among a number of militants planning further attacks in Iran, he said.
"We have warned everyone that any action against our nation, our national security will not go unanswered," the official added, speaking on condition of anonymity due to sensitivity of the matter.
IRAN 'LOST PATIENCE'
Iran has been pressing Islamabad for years to address the presence of militants near its border, Brew said. The missile strikes were a sign that Tehran has lost patience, he said.
To be sure, Iran continues to see its role and influence in the Middle East as a central to its security goals.
Brew said that Iran's strike on Pakistan was also intended to signal its resolve, to both enemies and allies, to defend itself in the context of the regional crisis over Gaza.
Michael Kugelman, director of the South Asia Institute at the Wilson Center, a Washington-based think tank, said bilateral tension on border security was a longstanding problem for Iran and Pakistan.
De-escalation would be difficult in the immediate term, "given the high tensions and temperatures at play", he said.
Neither country appears poised for conflict, however. In public statements, both countries have observed their attacks were not aimed at each other's nationals, and signalled they don't want escalation.
Kugelman said both countries might welcome bilateral dialogue and potential third party mediation from a country like China, which has good relations and leverage with both countries. "Diplomacy will be critical from here on out," he said.