Iran has admitted carrying out a missile and drone attack on western Pakistan on Tuesday.
Officials in Islamabad said two children were killed and three others injured in the attack in Balochistan.
Iran’s foreign minister said the operation targeted the militant group Jaish al-Adli, which he described as an “Iranian terrorist group” in Pakistan.
As a result the Pakistan’s government recalled its ambassador to Iran and has blocked Tehran’s envoy from returning.
The Balochistan attack comes after Iran attacked targets in Iraq and Syria earlier this week.
Islamabad said the attack was “illegal” and warned of “serious consequences”.
However Iran’s Foreign Minister Hossein Amir-Abdollahian, speaking in Davos, insisted that no Pakistani citizens had been targeted, only members of Jaish al-Adl.
“We only targeted Iranian terrorists on the soil of Pakistan,” Mr Amir-Abdollahian said.
He added he had spoken to his Pakistani counterpart and “assured him that we do respect sovereignty and territorial integrity of Pakistan and Iraq”.
The latest air strike comes at a time of growing tension across the Middle East, with war raging between Israel and the Palestinian group Hamas in Gaza.
Tehran says it does not want to get involved in a wider conflict. But groups in its so-called “Axis of Resistance”, which include the Houthi militants in Yemen, Hezbollah in Lebanon and various groups in Syria and Iraq, have been carrying out attacks on Israel and its allies to show solidarity with the Palestinians. The US and UK have launched air strikes on the Houthis after they attacked commercial shipping.
China on Wednesday urged Pakistan and Iran to show “restraint” and “avoid actions that would lead to an escalation of tension”. Foreign ministry spokesperson Mao Ning added that Beijing saw the countries as “close neighbours”.
Perhaps stung by recent deadly attacks on home soil, Iran seems intent on exacting revenge on those it sees as responsible.
At a time of heightened regional tensions, Iran is keen to portray strength and demonstrate to its own population that acts of violence will not go unpunished.
Tuesday’s strike in Pakistan hit a village in the vast south-western border province of Balochistan. Tehran said it was targeting Jaish al-Adl, or “army of justice”, an ethnic Baloch Sunni Muslim group that has carried out attacks inside Iran as well as on Pakistani government forces.
Last December Jaish al-Adl attacked a police station in Rask, a town close to the border with Pakistan.
Two weeks ago Iran suffered its worst domestic attack since the Islamic Revolution, when two bombs killed 84 people at a ceremony in Kerman to commemorate the US assassination of Iran’s notorious Revolutionary Guard general, Qasem Soleimani.
On Monday, Iran fired ballistic missiles at Syria and Kurdish-controlled northern Iraq. Iran said it was targeting Islamic State and Israel’s Mossad spy agency, both of whom it said had been involved in the Kerman bombings.
The strike on Iraq hit a building in the northern city of Irbil. Four civilians were killed and six hurt in the attack, local authorities said. The US condemned the attack.
Iran then struck Syria’s north-western Idlib province, which is the last remaining opposition stronghold in the country and home to 2.9 million displaced people.
But hitting its nuclear-armed eastern neighbour Pakistan is a dramatic escalation. Pakistan expressed outrage, saying the attack took place “despite the existence of several channels of communication” between the countries.
On Wednesday Islamabad said it had recalled its ambassador to Iran and the Iranian ambassador would not be allowed back into the country for the time being.
Pakistan and Iran have a delicate but cordial relationship. This attack took place on the same day as Pakistan’s prime minister and Iran’s foreign minister met in Davos and while the Iranian and Pakistan navies held military drills together in the Gulf.
Yet both have accused one another of harbouring militant groups that carry out attacks on the other in their border areas for years.
Security on either side of their shared border, which runs for about 900km (559 miles), has been a long-running concern for both governments.
The Iranian strike is believed to have hit Sabz Koh village about 45km from the Iranian border and 90km from the nearest town Panjgur. Local officials described it as a sparsely populated area home to livestock-owning Baloch tribes where smuggling of goods, drugs and weapons is rife.
“People on both sides of the border consider themselves to be deprived of basic necessities, face discrimination and demand a larger share from their own resources,” security commentator Zaigham Khan told the BBC.
In Iran, the Sunni Muslim Baloch minority complains of discrimination in the Shia Muslim-majority state, while Baloch separatist groups are continuing an insurgent movement against the Pakistani government.
Jaish al-Adl is the “most active and influential” Sunni militant group operating in Sistan-Baluchestan, according to the office of the US Director of National Intelligence. It is designated as a terrorist group by Washington and Tehran.
Another security commentator in Pakistan, Aamir Rana, told the BBC he thought the diplomatic crisis “would take a while to calm down but this is also something that Pakistan would not like to escalate”.
He said in the past Pakistan had not reacted to Iran’s actions along the border – “but now the ball is in Iran’s court, whether it wants to get its act right”.
Additional reporting by BBC Urdu’s Saher Baloch