Geography has never been an option for Pakistan. Iran is a neighbour, and shares with Iran long borders, cultural traditions and history. Saudi Arabia, on the other hand, has remained one of Pakistan's nearest neighbours in the Arab world and has been under a religious bondage, political confidence, economic interests and decades of defence cooperation with Islamabad. It has thus been necessary for Pakistan to have to deal with two countries whose own strategic rivalry has for a large part of its history hampered the politics of the region.

This balancing act comes at a time when it's taken a new and much tougher turn.

On August 7, Pakistan, Saudi Arabia and Türkiye signed a new defence pact, which ensures collective security, including through the mechanism that any armed attack against any one member will be considered an attack against all three. The deal is purely defensive and not targeting any country, Pakistani Foreign Minister Ishaq Dar has said. The Turkish government has also said the deal is not targeted at Iran. The deal is also said to be open to other countries that have the same principles in their foreign policies.

But in geopolitical terms there is little that an alliance says it is not. It also reflects the perception of the neighbouring states of the build-up of military ties around them.

That's why the Iranian response is so important.

Iranian Foreign Ministry spokesman Esmaeil Baghaei said in a statement on Monday that Tehran had no reason to be worried about the new Pakistan, Saudi Arabia and Türkiye security agreement. He did not scoff at it, but he said that such regional security cooperation can be useful, if it is inclusive, is representative of the realities of the region and takes into account the actual sources of insecurity.

Diplomatic breathing space is what that answer provides for Islamabad.

However, breathing space is not strategic certainty.

For years, Pakistan has been building its relationship with Saudi Arabia. The Defence cooperation between the two countries dates back many decades before the latest agreement. On the other hand, Pakistanis have been trained in Saudi Arabia and Saudi military personnel have been trained in Pakistan, and a Pakistani defence contingent has always been stationed in Saudi Arabia under bilateral agreement.

This relationship took on even greater significance in the recent regional crisis. The Pakistani government has once again publicly reiterated Islamabad's support for Saudi Arabia's territorial sovereignty and territorial integrity and, as recently as in July, has said it was committed to honouring its bilateral defence agreements with Riyadh.

The new trilateral agreement thus was not born out of the blue. It established and developed relationships that were already in formation.

Türkiye is another strategic player. The Ankara and Islamabad have already declared their relationship as a strategic partnership encompassing in-depth cooperation in defence, technology, counterterrorism and defence industrial production. They have a bilateral approach such as joint research and development, sharing and cooperation in new defence technologies.

Saudi Arabia is an economic and regional power. Türkiye provides a significant military and technologic base. Pakistan's military experience, strategic depth and a nuclear deterrent—only the other two partners have these—will be a plus for Pakistan.

However, the pairing is important even when it is not a NATO match.

In the case of Iran, Pakistan is not just a part of a distant geopolitical group. It is a neighbour.

This is an important distinction.

The border of Pakistan and Iran is about 900 kms long and the situation in Iran has significant implications for Pakistan's security, especially in Balochistan. The interdependence of the relationship is too multifaceted to be encapsulated in the language of strategic competition – it is one that is characterized by cross border militancy, trade, border management, energy connectivity and the movement of people.

But Islamabad has made it its recent months' clear that it has no intention to do so. In May President Asif Ali Zardari directed the Pakistan's Ambassador designate to Iran to prioritize trade, cross border connectivity and people to people relations. He also reaffirmed Pakistan's support for Iran's territorial integrity, sovereignty and political independence.

This role is far from just a rule of diplomat's etiquette. It's a geographical fact.

Pakistan can't push Iran to some other neighbourhood.

Nor can it look at Tehran solely in the context of its relations with Riyadh.

There is another reason why Islamabad has a margin of maneuver to hold onto this balance. Pakistan has always been hesitant to take a plunge between Tehran and Riyadh.

The most obvious instance of this was when Pakistan's Parliament refused to join the Saudi led military offensive in Yemen in 2015. The ruling said it showed the steps taken by Islamabad, despite keeping a close watch on relations with Saudi Arabia, didn't mean immediate involvement in all regional wars.

Ten years later, the situation is different and the strategic thought is still applicable. Cooperation between Pakistan and Saudi Arabia is best so long as Pakistan is not used as a pawn in the Saudi-Iranian game.

That differentiation is more significant now as the Middle East is no longer defined by the one-sided competition of the last ten years. In 2023, Saudi Arabia and Iran made a significant move towards easing tensions by agreeing to re-establish diplomatic ties and resume previous security and cooperation agreements, brokered by the Chinese government. Pakistan greeted the reconciliation and called itself to resolve positive engagement between the two nations.

This is where the current situation is so interesting.

But if Riyadh and Tehran can keep communication despite their strategic rivalry, there is no reason why Islamabad should decide to join them.

In fact, Pakistan's diplomatic worth could be that very thing which allows it to address both.

In the recent standoff between Iran and the U.S., Islamabad took the stance of a mediator of negotiations. Pakistan has hosted previous rounds of talks between the US and Iran and Islamabad Memorandum of Understanding signed in June was the result of a diplomatic process which involved Pakistan in a facilitating capacity. The Pakistani Foreign Office specifically gave this as an example of Islamabad's balanced and constructive approach to the region's crisis.

This presents an odd but perhaps strong situation for Pakistan.

It can enhance the level of defence cooperation with Saudi Arabia while not losing diplomatic ties with Iran. It can reinforce its strategic cooperation with Türkiye and at the same time contribute to dialogue with Tehran. It can join Riyadh as it defends against threats to Saudi sovereignty, just as it's stating that it's not involved in a conflict against Iran.

However, to maintain this balance will need one thing which Pakistan's foreign policy has not always had in abundance: consistency.

The biggest risk isn't in the defence pact. The real threat to the pact would be for it to include commitments or conclusions that Pakistan would be unable to accept in its relations with Iran.

The problem with an alliance is that it can become a default operation, making it a strategic threat.

The more each Saudi security challenge is seen as needing Pakistani military intervention, the more options Islamabad may have for maneuvering may become limited. Pakistan's western front may get complicated if Iran sees military assistance by Pakistan with the Saudi Arabia as a containment measure. On the other hand, if Pakistan's trust in Riyadh is lost on their commitment of defence, then the credibility of the partnership can be affected.

The problem then is to set boundaries.

Pakistan does not need to consider Iran as its adversary to protect Saudi Arabia.

It does not need to make the partnership against Iranian bloc.

Can enhance military ties with Riyadh without losing economic, diplomatic and security ties with Tehran.

That may be easier on Monday in Iran, as the country reacts to the news. By not immediately declaring the new pact a threat, Tehran is providing Islamabad time to stave off suspicions from becoming policies. Baghaei's focus on inclusiveness is important as it offers flexibility in how the agreement can be interpreted—and how it can be used—as a regional security endeavour, instead of a confrontation tool.

That is an opportunity that Pakistan must seize.

The validity of the Mecca Joint Defence Agreement will be put to the test once relations are smooth between member nations. It will come when Pakistan faces a crisis to determine its principles are defensive or expansive.

Strategic autonomy doesn't imply the absence of allies for Islamabad. It's having room for more than one partnership without one party influencing all of the others.

Pakistan's geographic location makes it much harder to be neutral between Iran and Saudi Arabia, but not impossible to be balanced.

Indeed, the geographical situation of the country could be the best case in favour of it.

Saudi Arabia is an indispensable strategic and economic partner. Iran is an indispensable neighbour. Türkiye is an ever-growing defence and technological partner. None of these relationships should be sacrificed to allow the others to flourish.

What Islamabad has to do now is none other than to balance Tehran and Riyadh. To ensure that Pakistan's association with the other does not mean hostility towards the other.

It will take disciplined diplomacy, carefully drawn defence pledges and a foreign policy that distinguishes partnership from alignment.