Writers observing the United States’ post-September 11th, 2001 relationship with Pakistan have often identified the country as a “frenemy,” or a reluctant, untrustworthy ally. Curiously, Iran and Pakistan have a similar ambiguous, pragmatic relationship characterized by fluctuating degrees of cooperation and mistrust. In February, for example, Iran threatened to send its forces into Pakistan after a Sunni militant group, Jaish al-Adl, kidnapped five Iranian border guards. “If Pakistan doesn't take the needed steps to fight against the terrorist groups,” Iran’s Interior Minister Abdolreza Rahmani-Fazli told the Mehr News Agency, “We will send our forces into Pakistani soil. We will not wait for this country.” Militants killed one guard, but released the others earlier this month. Yet despite fighting words in recent memory, Iran and Pakistan have just proceeded with joint naval exercises in the Strait of Hormuz.

Nascent governments, shared rivalries

Cooperation characterized the two countries’ relationship for decades after Pakistan formed. Iran was the first country to recognize Pakistan’s independence in 1947, as Cold War concerns and varying degrees of suspicion toward India brought the Shah and the new nation together.

“On the Iranian side you have a young shah who, having come to the throne at 21, is still very green, and he wants an anchor in the region,” says Alex Vatanka of the Middle East Institute. “He finds in young Pakistan a country he can turn to.” Pakistani leaders, Vatanka says, saw Iran as a useful ally against India. “They wanted as many allies [as possible]—preferably Muslim countries—to be on their side in what, in their view, was an existential fight.” Mohammad Reza Pahlavi shared Pakistan’s anti-India stance in part because India supported Egyptian President Gamal Abdel Nasser, whose pan-Arab ideology threatened Middle Eastern monarchies.

Vatanka, who has written a forthcoming history of Iran-Pakistan relations since 1947, says the 1950s and 1960s were a “golden age” for both parties. “You’ve got the common enemy of communism. That brings the Iranians and the Pakistanis together. In U.S. policy toward the region, you have the creation CENTO,” he says, referring to the U.S.-backed 1955 Baghdad Pact, which combined Britain, Turkey, Iraq, Iran and Pakistan in a NATO-like alliance. The United States hoped the agreement, which members renamed The Central Treaty Organization after Iraq pulled out in 1959, would guard the “Northern Tier” of the Middle East against the Soviet Union.

But the Shah began to doubt Pakistan in the 1960s. “The Shah had always considered Pakistan as a buffer state against the left-leaning Indians,” Vatanka says, but the 1965 Pakistan-India War left him shocked at Pakistan’s weakness. “You see from that period onwards [his] doubt emerging about the value of Pakistan as a strategic ally.” At the same time, Vatanka says, Pakistan sought alternative alliances with other neighbors, including China and the Arab Gulf States. “This upsets the Shah. And then you have the 1971 [Pakistan-India] conflict that really cements doubts that the Shah had about the way Pakistan was going.”

Despite offering Pakistan assistance in that conflict, Vatanka says, Iran began to see Pakistan as the “younger brother” in the relationship throughout the 1970s. The ensuing decade saw a “love-hate relationship” between the Shah and Pakistani Prime Minister Zulfikar Ali Bhutto. In 1978 the Islamist general Zia ul Haq mounted a successful coup against Bhutto. “Zia ul Haq [was] never able to endear himself to the Shah,” Vatanka says. “The shah did not like or trust [him].” Zia, for his part, saw the Iranian Revolution as “another opportunity for Pakistan to create an Islamic front against India.”

From Islamic fealty to near-conflict

Ruhollah Khomeini occasionally mentioned Pakistan in his revolutionary speeches, in one instance implying his disapproval of its relationship to the United States. In a December 1978 interview he lamented foreign Muslim leaders’ failure to support his movement. “Certain countries are satellites of the Soviet Union and others are satellites of America,” he said. He named Pakistan—then under the nascent Zia regime—among countries whose “rulers are afraid their own people will follow the example of Iran” although he was unclear whether he meant that Pakistanis might reject foreign influence, overthrow their leaders, or both.

Yet there was one sense in which revolutionary Iran followed a Pakistani model: Historian Said Amir Arjomand writes in After Khomeini that while the influential Pakistani Islamist thinker Abul Ala Maududi had “limited impact on the content of the 1956 Constitution of the Islamic Republic of Pakistan,” his conception of an “Islamic state” based on scriptural sources helped to generate “a new and ideologically powerful idea” of an Islamic state, which migrated to Iran “shortly before and during the Islamic revolution of 1979.”

Iran’s revolution marks the beginning of an ambiguous relationship between states with shared qualities and deep divisions. In April 1979 Zia praised Khomeini as “a symbol of Islamic insurgence,” and Pakistan was among the first countries to recognize the Islamic Republic of Iran. Khomeini, meanwhile, made the best of Zia’s Islamizing tendency, promising that relations would be “based on Islam.” But Iran was lukewarm. “The trouble for Zia ul Haq,” Vatenka says, “was that the revolutionaries [in Iran] looked at him [as the head of] a military fascist pro-American regime.” Pakistan, he says, tried to become a broker between Iran and the United States, but Iran refused to let it play that role.

Ahmed Rashid, a leading journalist who covers the region from Lahore, says Pakistanis at first offered the Iranian Revolution “general support,” but that sectarian considerations soon tempered their enthusiasm. “Very quickly there was a lot of division between the majority Sunnis and the minority Shias,” Rashid says, “especially after Iranian leaders started talking about the expansion of revolution in neighboring states.” Rather than seeing the revolution as an anti-American, anti-Shah revolution, Rashid says, some came to see it as a revolution for the spread of Shi’ism.

Yet Pakistan’s Sunni majority and its strong relations with Arab Gulf States did not cause it to support Iraq in the Iran-Iraq conflict, and it even lent Iran modest support. “[Pakistan] kept out of it, basically, because Iran was a neighbor,” Rashid says. “It helped the Iranians to some extent in terms of food supplies and trade. In fact, a lot of barter dealing was set up which helped Iran at that time.” He says that Pakistan at that time had “a very sensitive relationship with Iran, especially concerning Afghanistan.”

Iran and Pakistan both supported Afghan mujahedeen who fought the Soviet Union in the 1980s, but their competition inside Afghanistan has retained the potential to upset relations ever since. “They are both rivals for greater influence, [and support] different sects of people,” Rashid says. Pakistan backs the Pashtun, while Iran affiliates itself with the Shia Hazara minority, and with non-Shia minorities, including Tajiks, Uzbeks, and Turkmen. In 1998 Iran nearly invaded Afghanistan after the Taliban killed five of its diplomats in Mazar-e Sharif. “[Iran’s] relationship with Pakistan was at its worst,” Rashid says, “because Pakistan was strongly backing the Taliban. That’s the closest the two countries ever came to real conflict.”

“The relationship with Khan started as an outgrowth of some other talks Iran was having with Pakistan about above-the-board nuclear cooperation in the 1980s,” says Mark Fitzpatrick, a former U.S. State Department official now with the International Institute for Strategic Studies. “He gave a big boost to Iran’s enrichment program, helping them skip a couple of the initial steps in building centrifuges.” The centrifuges Khan sent, Fitzpatrick says, did not work properly, but Khan also sold Iran a second-generation centrifuge, which proved useful.

Fitzpatrick says that in addition to civil nuclear cooperation, the nations’ representatives also discussed weapons-related technology. “There was an inclination on the part of some Pakistani officials to support Iran’s weapons interests,” Fitzpatrick says. “When [General Aslam Beg] was chief of staff of the Pakistan military, he openly talked about assisting the ummah, the world Islamic community, with nuclear weapons development.” Beg, Fitzpatrick says, gave Khan “a wink and a nod to engage in what he did.” Although western intelligence agencies have never been able to interview Khan, he says, “They would like to, to get a full understanding of what he transferred, including weapons-related [information].”

Iran, Fitzpatrick says, claims Pakistani assistance slowed its nuclear progress. “Like people of many countries, they would like to claim indigenous work. When it’s pointed out that, ‘Hey, you got the stuff from Khan,’ they respond by saying, ‘What he gave us was junk, and it actually retarded our development.’ They’re gilding the lily there.”

Any nuclear cooperation is now likely over, Rashid says, “because there’s much more tension [now].” Indeed, there may be a hint of nuclear rivalry between the two countries. “Iran is trying to acquire a nuclear program because it feels surrounded by nuclear powers, one of which is Pakistan,” Rashid says.

Tension and pragmatism

One persistent source of friction is the countries’ friendly relations with each other’s regional adversaries: Iran maintains good relations with India, while Pakistan keeps close to Saudi Arabia. Pakistan, Rashid says, finds “quite galling” India’s assistance to Iran in building a railway from Chabahar, a port city in Iran’s Sistan and Baluchistan province, to Herat, Afghanistan’s third-largest city, “In other words bypassing Pakistan, and giving India reason not to deal with issues with Pakistan.” Iran and Saudi Arabia, he says, have a long history of fuelling sectarian movements in Pakistan, a phenomenon that has since metamorphosed into an indigenous sectarian struggle. Since Pakistan is a Sunni majority country, he says, it has always tended to back the Saudis.

And yet such divisions seldom tip broader relations into crisis. “Pragmatism seems to prevail in the relationship,” says Edward Wastnidge, Lecturer in Politics and International Studies at the Open University. Wastnidge sees the two countries working together to fight drug smuggling and collaborating through the Organization of the Islamic Conference and the Inter-Islamic parliamentary Union, and Economic Cooperation Organization. “Iran sets a lot of store in taking part in these regional institutions because it gives them a sense of normality on the international stage,” he says. “Iran is keen to maintain a good diplomatic relationship with Pakistan.”

The countries’ outside rivalries may have helped to keep their relationship pragmatic. “On the list of priorities in the respective capitals, they have chosen not to pick a bigger fight with one another, Vatanka says. “Pakistan lives to hate India. That helps to explain why Pakistan has, for the past 35 years, very deliberately sought not to antagonize Iran any more than it has to.” In the recent case of the missing border guards, he says, “The Pakistanis were very careful about what they said, despite very harsh words from the Iranian side. That’s Pakistan that’s nuclear-armed, being on the defensive against Iran!”

“Relations are very tense,” Vatanka says, referring to conversations he has had with diplomats on both sides. But he also notes a division between the Pakistani foreign ministry, whose diplomats are more enthusiastic about relations with Iran, and the Pakistani military, “who happen to call the shots.” “Pakistani diplomats would tell me, ‘We could reach an agreement and we would go back home and be told by our colleagues in uniform, ‘It’s not going to happen.’’” Vatanka says he suspects both countries’ intelligence services are “the driving force behind their bilateral relations,” and that this “security prism” makes the political relationship stagnant.

Vatanka cites the countries’ failure to build a long-planned pipeline to deliver Iranian gas to its energy-deprived eastern neighbor as a symbol of the countries’ mistrust. “That ought to have been done by now,” he says. “It’s been on the table for about 20 years.” He dismisses Iranian and Pakistani claims that the project failed because of U.S. sanctions, and points to deeper dysfunction. “Sanctions might have been a factor for the last couple of years. They weren’t a factor in ’95, ’96,” he says. “There is this issue, nobody wants to admit to it, but they don’t trust one another, and they don’t have a vision. They don’t have smart people sitting in Islamabad and Tehran and looking at how relations could improve. Neither side really wants to deal with the other.”

While potential sources of resentment in the Iran-Pakistan relationship appear immutable, both sides share an interest in managing them so long as they build their identities on external rivalries. “Frenemies,” even in tough times, is their default position.