Pakistan has called for a peaceful resolution to escalating tensions between Saudi Arabia and Iran, offering to act as a mediator for the two Middle Eastern rivals while refraining from making specific commitments to its ally Riyadh.

The South Asian nation, which shares borders with Iran, has been reluctant to take sides in the ongoing diplomatic hostilities - despite visits by top Saudi officials.

"Pakistan doesn't know where to stand because Islamabad and Riyadh have very close ties from the last few decades," Asim Sajjad, a columnist at the Dawn newspaper and professor at Quaid Azam University in Islamabad, told Al Jazeera.

Beyond sectarianism: The Saudi-Iran confrontation - The Listening Post

"In the meantime, Iran is the physical neighbouring country of Pakistan."

In a statement issued following his meeting with Saudi Defence Minister and Deputy Crown Prince Mohammed bin Salman, Pakistan's Prime Minister Nawaz Sharif said on Sunday his country has "historically pursued the policy of promoting brotherhood" among Muslim countries.

READ MORE: Who rules Pakistan?

"Pakistan has also always expressed its readiness to offer its good offices to brotherly Muslim countries for resolution of their differences," Sharif said in a press conference.

Salman also met with the country’s powerful military chief, General Raheel Sharif, who declared Pakistan's willingness to stand by Saudi in case of any threat to the Arab state's territorial integrity.

"Any threat to Saudi Arabia's territorial integrity would evoke a strong response from Pakistan," Sharif said in a statement.

'Bad gesture'

The diplomatic crisis comes weeks after the kingdom also formed a coalition against terrorism. In both cases, Pakistan came up short of backing Saudi.

"It's a very hard time for Pakistan to make a final decision whether to support Saudia or Iran," Sajjad said.

"If Pakistan supports Iran, being a Sunni-majority country, a strong reaction is expected from the people of Pakistan as well as religious fanatics," he said.

On the other hand, if Pakistan tries to remain neutral, the move will be considered as a "bad gesture" to Saudi, which has long been supporting Islamabad economically, Sajjad added.

The talks between Pakistan and Saudi were kept highly secret.

Syed Kurshid Shah, leader of the opposition in the Pakistan national assembly, cautioned the government against taking sides.

Sartaj Aziz, an advisor to the prime minister on foreign affairs, said Pakistan will keep its national and international interests in mind before commenting on the dispute.

"Safeguarding Pakistan's national and international interest is our top priority," he said.