Iranian President Hassan Rouhani and Pakistani Prime Minister Nawaz Sharif have vowed to boost cooperation on regional security and trade during talks in Islamabad, the first visit by an Iranian head of state in 14 years.
Rouhani said he and Sharif had agreed on Friday to fight "extremist and terrorist groups" in their countries' shared border, as the two leaders announced the opening of two new crossing points to encourage trade long hampered by sanctions.
"We place emphasis on the need for cooperation between our two countries, on regional security," Rouhani said, adding that issues related to energy, gas the export of electricity were also discussed.
Meanwhile, Sharif said he hopes the opening of two new crossings would contribute to "economic integration" in the region, while promoting tourism and "people to people contacts".
READ MORE: Pakistan's conundrum over the Saudi-Iran feud
Pakistan, a majority Sunni country, has traditionally close ties with Saudi Arabia, which is hostile to Iran, a Shia power.
The kingdom accuses Tehran of supporting Shia Houthi rebels in Yemen against the internationally recognised president, Abd Rabbu Mansour Hadi.
Saudi Arabia has been leading a coalition of mostly Gulf Arab states in an air-campaign against the Houthis in the conflict, widely seen as a proxy Saudi-Iran war.
Last year, Pakistan refused a Saudi request to send troops into Yemen after a vote in Parliament delivered an overwhelming "no."
In an interview with Al Jazeera, Mosharraf Zaidi, a former advisor to Pakistan's foreign ministry, said Rouhani's visit is "proof positive" that Pakistan cannot maintain a relationship with Saudi and other Gulf countries "at the expense of a useful and functional" ties with Iran.
Rouhani's visit is also expected to discuss a controversial gas pipeline from Iran, through Pakistan to India.
Work has stalled on the Iran-Pakistan section, which was designed to help Pakistan meet its energy needs.
Iran has invested over $2bn in the project, but Pakistan has yet to finish construction on its half of the pipeline.
Al Jazeera's Kamal Hyder, reporting from Islamabad, said Pakistan needs Iran to supplement its energy needs as its industrial output has hit a "virtual standstill."
Washington had for years opposed the project amid concerns over Tehran's nuclear programme.
Source: Al Jazeera and agencies