Iran's President Hassan Rouhani said Saturday Tehran was not interested in maintaining tensions with Saudi Arabia and responded positively when Pakistan tried to mediate between the two rivals.
Speaking at a news conference in Islamabad to mark the end of his two-day visit to Pakistan, Rouhani said Saudi plays an important role in the Muslim world and that "if there is any problem between two countries, it should be resolved through talks."
"Iran's nuclear pact is an example for the world. We have overcome problems through dialogues," he said.
Pakistan is a key ally of Saudi Arabia and shares a long border with Iran.
The trip was Rouhani's first visit to Pakistan, and followed efforts by Saudi Arabia to court Islamabad to increase its participation in a new Saudi-led military alliance of mostly Sunni nations, a coalition perceived by Tehran as an anti-Shiite block.
The kingdom has accused 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 strikes against the Houthis. Despite Saudi pressure, Islamabad last year refused to send troops into Yemen.
Pakistani Prime Minister Nawaz Sharif visited Saudi Arabia and Iran in January to mediate between the two regional powers.
Rouhani also said his country was ready to help Pakistan overcome its energy problems.
"Iran has constructed a gas pipeline up to the Pakistani border and now we are ready to provide gas to Pakistan," he said, adding that he hoped Pakistan would complete the pipeline on its side. Work on the Pakistan-Iran pipeline has been stalled for years because of sanctions on Iran, which invested over $2 billion in the project.