ISLAMABAD (AP) — Iran's Hassan Rouhani arrived Friday in Pakistan on a landmark visit, his first since becoming president, at a time when Saudi Arabia is courting Islamabad to increase participation in a new Saudi-led military alliance of mostly Sunni nations, a coalition perceived by Tehran as an anti-Shiite block.

In a televised statement following meetings between Rouhani and Pakistan Prime Minister Nawaz Sharif, the two leaders said they wanted to forge a relationship built on economic development and shared interests.

Inside the prime minister's residence in the Pakistani capital, Islamabad, the two leaders announced the signing of several memorandums of understanding in fields such as health, diplomatic training, trade and commerce.

They also announced the opening of two additional border crossings between the two nations.

Speaking through an interpreter, Rouhani said Pakistan's security was as important to Iran as its own. He said terrorism is a scourge both countries face.

Pakistan, a majority Sunni country, has traditionally close ties with Saudi Arabia, which is hostile to Iran, a Shiite power. The kingdom accuses Tehran of supporting Shiite Houthi rebels in Yemen against the internationally recognized president, Abed Rabbo Mansour Hadi.

Saudi Arabia has been leading a coalition of mostly Gulf Arab states in a blistering air-campaign against the Houthis in the conflict in Yemen, 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." Prime Minister Nawaz Sharif visited the kingdom in January, expressing support for the alliance but without making any military commitment. Local Pakistani papers have carried unconfirmed reports that Saudi Arabia asked Pakistan's military chief, Raheel Sharif, to head the alliance.

Rouhani's visit is also a landmark moment for Iran, after international sanctions were lifted in the wake of the nuclear deal between the Islamic Republic and world powers.

"This visit means a lot," said Imtiaz Gul, executive director of the Islamabad-based Center for Research and Security Studies, adding that Pakistan is still "ambivalent" about its participation in the new Saudi-led alliance.

Pakistan, a Muslim-majority country of 180 million, has a Shiite minority that makes up about 15 percent of the population.

The country frequently sees Sunni militant groups attacking the Shiite minority, which in turn has accused Saudi Arabia of financing groups like Lashkar-e-Jhangvi, blamed for many such deadly attacks. For their part, the militant Sunni groups accuse Iran of financing a Pakistani militant Shiite group, Tehreek Nafaz-e-Fiqh-e-Jafariya.

On the eve of his visit, Rouhani said that "constructive relations with neighbors and the Islamic world are at the priority list of our foreign policy."

"Destabilization of others causes everlasting conflicts that benefit nobody," he said in a veiled reference to Saudi Arabia.

"I believe that at this crucial moment of the history of relations between the two countries, it is essential that Pakistan and Iran ... lay the cornerstone of a new bilateral engagement based on the mutual interests of the two countries," Rouhani added in his statement.

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 $2 billion in the project, but Pakistan has yet to finish construction on its half of the pipeline.

Washington had for years opposed the project amid concerns over Tehran's nuclear program.

At a meeting with Iranian business representatives Friday Miftah Ismail, Chairman of the Pakistan Board of Investment and Sui Southern Gas Company, said the Iran- Pakistan- India pipeline is a priority for Sharif's government, as is a north-south pipeline Pakistan is building with China.

With relentless and protracted power outages throughout the country, finding new energy sources has become critical in Pakistan.