Pakistan said Thursday it carried out strikes against militant targets in Iran, with Tehran reporting a death toll of nine civilians after staging its own air raid in Pakistan earlier this week.
Nuclear-armed Pakistan and neighbouring Iran are both battling simmering insurgencies along their sparsely populated border regions.
The cross-border attacks add to multiple crises across the Middle East, with Israel waging a war against Hamas in Gaza and Huthi rebels in Yemen attacking commercial vessels in the Red Sea.
"This morning Pakistan undertook a series of highly coordinated and specifically targeted precision military strikes against terrorist hideouts" in Iran's Sistan-Baluchistan province, Pakistan's foreign ministry said.
It said the action was taken in light of "credible intelligence of impending large-scale terrorist activities", adding that "a number of terrorists were killed".
Iran's official IRNA news agency reported that at least three women and four children were killed in blasts around the city of Saravan in the country's southeast, later adding that two men had also died.
Iran's foreign ministry summoned Pakistan's charge d'affaires "for an explanation", according to the Tasnim news agency.
Tehran and Islamabad frequently accuse each other of allowing militants to operate from the other's territory to launch attacks, but it is rare that official forces on either side engage.
"Pakistan fully respects the sovereignty and territorial integrity of the Islamic Republic of Iran," Islamabad's foreign ministry said.
"The sole objective of today's act was in pursuit of Pakistan's own security and national interest which is paramount and cannot be compromised."
Beijing said Thursday it was willing to mediate between Pakistan and Iran following the exchange of fire in their border region.
"The Chinese side sincerely hopes that the two sides can exercise calm and restraint and avoid an escalation of tension," foreign ministry spokeswoman Mao Ning told a regular press conference.
The United States on Wednesday condemned the Iranian strikes in Pakistan, Iraq and Syria.
State Department spokesman Matthew Miller said Tehran had violated the "sovereign borders of three of its neighbours in just the past couple of days".
Pakistan's caretaker Prime Minister Anwar-ul-Haq Kakar will cut short his visit at the World Economic Forum in Davos, Switzerland, "in view of the ongoing developments", foreign ministry spokesperson Mumtaz Zahra Baloch said in a press conference in Islamabad.
Hours before the strike, Kakar had met the Iranian foreign minister on the sidelines of the Davos summit and posed for photographs.
Baloch said no information had been shared with Pakistan ahead of Iran's earlier strike on its soil.
Iran staged missile and drone attacks on the Jaish al-Adl group late Tuesday, after launching attacks in Iraq and Syria against what Tehran called "anti-Iranian terrorist groups.
Islamabad said the attack in its territory killed "two innocent children".
The government called the strike an "unprovoked and blatant breach of Pakistan's sovereignty" and recalled its ambassador to Iran and blocked Tehran's envoy -- currently in Iran -- from returning to the country.
Iranian foreign minister Hossein Amir-Abdollahian said Wednesday that Tehran respected the sovereignty of Pakistan but would not allow his nation's security "to be compromised or played with".
Formed in 2012, Jaish al-Adl is blacklisted by Iran as a terrorist group and has carried out several attacks on Iranian soil in recent years.
Pakistan has not specified where Tuesday's Iranian strike took place.
But Pakistani media said it was near Panjgur in southwest Balochistan province, where the countries share a border of nearly 1,000 kilometres (620 miles).
The Pakistani military has been waging a decades-long fight against ethnic Baloch separatists in the province, the largest but poorest region of the country.
Currently led by a caretaker government, Pakistan is just three weeks away from general elections with its most popular politician, Imran Khan, in jail and his supporters stifled.