This article was first published on Foreign Policy's South Asia Channel.

The rejection last month by a unanimous vote in Pakistan’s parliament of a Saudi request to join in military action in Yemen, and a hurried visit to the Kingdom by Prime Minister Nawaz Sharif and Army Chief Raheel Sharif, have given fresh perspective on the nature of Pakistan’s security ties with the Kingdom. It has called into question what has been almost an article of faith among the Washington political cognoscenti: that Saudi Arabia holds an indebted Pakistan in its back pocket. This belief leads many to assume that Pakistan can always be depended on to come to Saudi Arabia’s defense, most critically against Iran if it ever acquires nuclear weapons. But such thinking overlooks the priority that Pakistan gives to its own perceived national interests and how heavily neighboring Iran weighs in its strategic calculus.

Pakistan has regularly figured in Saudi Arabia’s defense planning. Ever since the 1960s, the Pakistan military has shown a willingness to come to the Saudis’ assistance, including serving as protectors of the royal family. For decades Saudis have received military training from Pakistani army and air force personnel. In exchange, the Saudi Kingdom has bailed out governments in Islamabad during times of financial crisis, most notably by providing timely oil concessions. Saudi Arabia could not at present hope for a more sympathetic Pakistani leader than Prime Minister Sharif. Deposed from office in 1999 and facing murder charges, Sharif was rescued through Saudi intervention and provided comfortable exile until President Pervez Musharraf permitted him to return to Pakistan in 2007.

The bonds that have historically brought military support to the Saudi Kingdom from the Muslim world’s largest army and only nuclear power go beyond those of a transactional relationship. Saudi Arabia, the site of Islam’s holiest places, enjoys a deep spiritual connection with most Pakistanis. Primarily through generous donations to mosques and madrasas, the Saudis have succeeded in promoting their conservative Salafi brand of Sunni Islam in a country with the world’s second largest Muslim population. But more importantly, Saudi Arabia’s interest in Pakistan cannot be separated from the endemic geostrategic and economic struggle that the Saudi state wages against Shi‘a Iran.

April 23, 2015 - Marvin Weinbaum, director of the Center for Pakistan Studies at The Middle East Institute, explains Pakistan’s decision not to provide military aid for Saudi Arabia’s operation in Yemen, and how Prime Minister Sharif is working to repair relations with Riyadh.

Pakistan has avoided openly taking the Saudi side in that competition. Faced with security concerns on its Indian and Afghan borders, Pakistan has no need for a contentious third border with Iran. Pakistan and Iran share a common interest in suppressing their adjoining Baloch separatist movements. During the Afghan civil wars in the 1990s Pakistan and Iran were actively backing opposing forces yet managed to avoid a direct military face-off. Greatly feared in Pakistan is that an alienated Iran might retaliate by aggravating sectarian tensions in Pakistan, much as it did in 1980s. Testifying to Iran’s desire to also maintain a reasonably normal relationship is its reluctance in recent years to criticize Pakistan’s security policies, despite a spike in domestic violence by Sunni extremists against segments of Pakistan’s Shi‘a community of 40 million.

Pakistan has other motives for preferring to keep relations with Iran harmonious. To help address its severe energy deficit, Pakistan is anxious to see the construction of a pipeline that can supplement its Saudi oil imports with gas from Iranian fields. Despite vigorous opposition by the Saudis and Americans that has stymied a deal with Tehran, the project has acquired new life with the prospect of Chinese financing. Joint investments for improving rail, road, and sea links are being discussed. On the same day that Prime Minster Sharif was visiting Riyadh to assuage Saudi feelings over Yemen, the governments of Pakistan and Iran were announcing their intentions to boost bilateral trade fivefold. Their cooperation could also go far in ensuring the survival of an Afghan state in which both have a growing stake.

Pakistan has until now avoided having to directly choose between the Saudi Kingdom and Iran. In past deployments of forces to Saudi Arabia and the region Pakistan has at times found itself opposing Iranian client groups. However, Pakistan’s participation in an undisguised anti-Iranian military alliance in Yemen would move closer than ever to directly taking sides. Instead, Pakistan chose to declare its neutrality and called for a ceasefire and coalition government, a position closely resembling Iran’s thus far low-key response to the Saudi intervention. Not incidentally, Iran’s Foreign Minister Javad Zarif had urged a political solution in his early April visit to Islamabad. But it was a reluctant military that ultimately dictated Pakistan’s decision on Yemen. With the army deeply engaged along Pakistan’s Afghan and India frontiers, there is little enthusiasm for becoming entangled in a foreign venture that also lacks support from a war-weary public.

Nothing would so test Pakistan’s ability to retain some balance between Saudi Arabia and Iran than a Saudi request for Pakistan to commit fully to the Kingdom’s defense against a nuclear-capable Iran. Maximally, it could take the form of a transfer of nuclear warheads to Saudi Arabia, presumably to be placed on missiles purchased from China. Pakistan might also assist with the transfer of the technology needed for the Saudis to jump-start a nuclear program. Or it could possibly satisfy Saudi Arabia with a declared nuclear umbrella, a commitment to retaliate should Iran launch an existential attack on Saudi Arabia.

Pakistan can be expected to disappoint Saudi Arabia by withholding nuclear transfers. Taking either option would earn Pakistan the opprobrium of an international community that is particularly sensitive given Pakistan’s past history of nuclear proliferation. Aside from having to deal with new sanctions, Pakistan’s strategic elites would probably question policies that distract the country from addressing its own defense priorities and turn Iran into a bitter adversary. Making the case that Iran’s nuclear breakout warranted extraordinary countermeasures might be difficult for a county that itself achieved a nuclear capacity clandestinely.

Offering Saudi Arabia a nuclear umbrella might be easier for Pakistan, particularly if portrayed as an extension of prevailing security guarantees. But its usefulness is limited. The threat to Saudi Arabia from a nuclear-armed Iran would come less from an attack on Saudi soil than from Iran’s use of its newly acquired military muscle to assert regional influence. In any case, were the Saudi regime to be brought down it is more likely to come from factors within than from forces without. In such an internal crisis Pakistani troops and planes will be of little help.