Pakistani PM Imran Khan's visit to Iran, the first since he took office last year, comes after gunmen who Islamabad says were based in Iran killed 14 members of Pakistan's security forces last week in Balochistan province.
Iran and Pakistan have agreed to set up a joint border "reaction force" following a spate of deadly attacks by militant groups on their frontier, Iranian President Hassan Rouhani announced on Monday after talks with visiting Pakistani Prime Minister Imran Khan.
"We agreed to create a joint rapid reaction force at the borders for combatting terrorism," Rouhani told a joint news conference, following months of increased tensions over attacks on both sides of the frontier.
The border skirts the volatile southeastern Iranian province of Sistan-Baluchistan which has been the scene of frequent attacks on Iran's security forces.
"The security chief will sit down with his counterpart here and discuss (security) cooperation," Khan said, although no details were given on the joint force.
"We trust that both countries will not have terrorist activities from their soil ... We will not allow any damage to your country from our soil," said the Pakistani premier who started a two-day visit on Sunday.
In March, Rouhani demanded Pakistan act "decisively against anti-Iranian terrorists", following a February 13 attack that killed 27 members of the elite Revolutionary Guards in Sistan-Baluchistan.
Iran has said a Pakistani suicide bomber was behind the attack, which was claimed by Jaish al-Adl (Army of Justice), which Tehran says operates mostly out of bases in Pakistan.
On Saturday, Islamabad said it had evidence the "terrorist outfits" that carried out the attack in Balochistan had "training and logistic camps inside Iranian areas bordering Pakistan".
"No third country"
Stressing that "no third country" could harm Iran-Pakistan ties, an apparent reference to the United States and its policy of isolating the Islamic republic, Rouhani said Tehran was ready to boost trade and business ties with Islamabad.
"Iran is ready to meet Pakistan's oil and gas demands ... (and) we are ready to increase (electricity) exports to Pakistan ten-fold," Rouhani said.
He said cooperation between Chabahar port in southeast Iran and Pakistan's Gwadar port can be increased, and that Tehran could facilitate the construction of a railroad connecting Istanbul to Islamabad.
TRT World's Mobin Nasir takes a look at Tehran-Islamabad economic ties.
For his part, Khan said his visit to Tehran — the first by a Pakistani premier since Nawaz Sharif in 2016 — aimed to "find ways to increase trade and cooperation... in energy and other areas", noting that two-way trade was "very limited".
Pakistan is a close ally of the United States and Saudi Arabia, both of which have ratcheted up pressure on Iran over its alleged meddling in regional affairs.
Washington last year pulled out of the 2015 Iran nuclear deal signed by Tehran and world powers and reimposed harsh economic sanctions on the Islamic republic as part of a "maximum pressure" campaign.
Saudi Arabia and a number of its Arab allies cut diplomatic ties with Tehran in 2016 after protestors burned Saudi diplomatic missions in Iran in reaction to the kingdom executing Shia cleric Nimr al-Nimr.