In April 2008, Iranian president Mahmoud Ahmadinejad visited Pakistan as part of a whistle-stop tour of South Asia. The meeting was cordial but tense. While the two neighbors were once staunch Cold War allies, the Islamic Revolution, Afghanistan's civil war, and Pakistan's nuclear development have transformed the relationship into one of tense rivalry. As Afghanistan's stability has become a U.S. strategic concern, preventing Pakistan-Iran tensions from again transforming Afghanistan into a proxy battlefield should be a U.S. interest. Unfortunately, so long as the Iranian and Pakistani governments remain concerned with the defense of Shi'i and Sunni sectarian interests respectively, U.S. and NATO forces in Afghanistan may not be able to bring stability but at best may remain referees in a struggle that extends far beyond that country's borders.
A Troubled Triangle
Pakistan and Iran are bound by cultural, tribal, and religious bonds. Pakistan gained its independence in 1947 at the beginning of the Cold War. Iran became the first state to recognize the new nation, and the two neighbors soon developed a strong partnership, signing a treaty of friendship in 1950. Some of this was geopolitical. Pakistan was born amidst great bloodshed and a transfer of population with India, a country with which Pakistan has territorial disputes to the present day. Pakistan found a natural partner in Iran after the Indian government chose to support Egyptian president Gamal Abdel Nasser who sought to export a pan-Arab ideology that threatened many Arab monarchies, a number of which were favored by the Iranian shah. Iran was a natural ally and model for Pakistan for other reasons as well. Both had majority Muslim populations but remained secular, centralized, and Western-oriented in practice. Both countries granted the other most-favored nation status for trade purposes; the shah offered Iranian oil and gas to Pakistan on generous terms, and the Iranian and Pakistani armies cooperated to suppress the rebel movement in Baluchistan.
Both countries also became major bulwarks of U.S. policy in the Middle East. Both were firm U.S. allies and members of the anti-Soviet Baghdad Pact. In 1971, however, the geopolitical situation began to shift. The withdrawal of British forces from the Persian Gulf left the United States to fill the vacuum, making Saudi Arabia far more important in U.S. strategic calculus. Pakistan's defeat in its 1971 war with India—and the loss of half its territory with Bangladesh's independence—led it to court China as a means to balance India. Pakistan also sought closer ties with the Arab states in order to isolate India, and thus weakened its ties to Iran, even though Islamabad-Tehran relations remained cordial.
The shah's fall in 1979 was a blow to Pakistan. Ayatollah Ruhollah Khomeini's anti-American posture worried the Pakistani authorities, as did the prospect of any export to Pakistan of Khomeini's radical views. After all, in 1979, perhaps 20 percent of Pakistan's population was Shi'i and, at the same time, Khomeini's religious rhetoric sparked radicalism across the sectarian divide. Nevertheless, Islamabad offered an olive branch to Tehran. Pakistan was among the first countries to recognize the new Islamic Republic and was among very few countries in the region that refrained from supporting Iraq during the Iran-Iraq war.
The 1979 Soviet invasion of Afghanistan brought the Soviet Union to Pakistan's doorstep, transforming the geostrategic environment further, all the more so given India's close ties to Moscow. For the United States, concerned about Soviet expansionism, Pakistan's importance rose. Ironically, Pakistan, Iran, and the United States all found themselves on the same side with regard to Afghanistan, even as Iran's revolutionary authorities continued to hold U.S. diplomats hostage. Though Iran was preoccupied with domestic turmoil and its war with Iraq in the 1980s, it supported the Afghan resistance and provided limited financial and military assistance to groups who supported the Iranian vision of revolutionary Islam.
Meanwhile, Pakistan emerged as the frontline state in the U.S. struggle to expel the Soviets from Afghanistan. Here, the Pakistani military regime under General Zia ul-Haq did try to coordinate with the Islamic Republic but, in practice, Islamabad cooperated much more fully with Saudi Arabia, which bankrolled Pakistani military programs.
Pakistan became the transit point for weapons and aid to Saudi-funded, U.S.-equipped, and Pakistani-trained mujahideen who fought to drive the Red Army from Afghanistan. Pakistani authorities, however, put a filter on the aid. The loss of Bangladesh—formerly East Pakistan—in 1971 had led the Pakistani leadership to be very wary of ethnic nationalism. Pashtun nationalism in Afghanistan had challenged Pakistani cohesion for as long as Bengali nationalism. The Pakistani government, therefore, only allowed aid to flow to those groups who rallied around a sectarian rather than a nationalist identity.
The Iranian authorities, in contrast, miscalculated. While generous with aid to their allies, they had far fewer resources at their disposal because of the ongoing war of attrition with Iraq. That aid which Iranian officials could provide, they limited largely to Shi'i and ethnic Persian-speaking Tajik groups. This transformed a potential Afghanistan-wide influence into a far more localized interest. Nor, in contrast to the actions of the Pakistani leadership, did Iranian authorities properly cultivate or manage their population of Afghan refugees in order to spread their influence. 
Tehran did not want to cede the advantage to Islamabad, though, and continued to fight for influence in Afghanistan, even as the Pakistani- and Saudi-backed Taliban consolidated control over 90 percent of the country. This proxy fight, however, polarized Afghanistan and brewed further Pakistan-Iran mistrust.
In August 1998, after an incident in which the Taliban sacked an Iranian consulate in Mazar-i-Sharif and murdered six Iranian diplomats and some agents, the Iranian military massed some seventy thousand troops on their border with Afghanistan and blamed Pakistan, claiming that Pakistan had assured the safety of their diplomats. Iranian president Mohammad Khatami, however, helped walk Iran back from the brink of war as he sought to thaw relations between Iran and both the United States and the Taliban.
The 9-11 terrorist attacks on the United States changed the foreign policy priorities of both Iran and Pakistan. The George W. Bush administration's tough stance forced president Pervez Musharraf to support Washington's "war on terror," which ended Taliban rule in Kabul. Though Iranian officials welcomed the move, they soon found themselves encircled by U.S. forces in Pakistan, Afghanistan, Central Asia, and the Persian Gulf. President Bush's inclusion of the Islamic Republic as part of an "Axis of Evil" also led some Iranian officials to presume that Tehran might be next in line for regime change and ended whatever détente had occurred in U.S.-Iranian ties under Khatami. Bush's emphasis on transformative diplomacy and democratization worried Iranian leaders further.
Tehran and Islamabad sought to improve bilateral relations after the Taliban's 2001 fall. Iran supported the Bonn agreement which, under U.N. auspices, brought prominent Afghans together to plan for the future governance of their war-ravaged nation. In December 2002, Iran signed the Kabul Declaration on Good Neighborly Relations along with Pakistan and other regional states. Khatami visited Islamabad in December 2002, the first visit by an Iranian head of state since 1992. Iran has tried to project itself as a responsible regional actor since the fall of the Taliban in 2001, urging the Afghan Northern Alliance to accept the Bonn agreement for the formation of a new broad-based government in Kabul and offering aid and loans as well as training Afghan soldiers. It is investing in construction projects in the western parts of Afghanistan, building roads, rail links, and border posts. It played a major role in restarting the post-Taliban political process in Afghanistan and has pledged $560 million in aid and loans to Afghanistan. However, other interests are also at play as Iran supports conservative Shi'i religious schools and warlords and is increasing its intelligence activities across Afghanistan. Iran has viewed itself traditionally as the guarantor of the security of Afghanistan's Shi'a.
However, the situation in Afghanistan continued to overshadow the relationship. Tehran moved promptly to establish diplomatic ties with Hamid Karzai's new government. Iranian authorities supported Karzai's attempts to exert authority over the entire territory of Afghanistan, encouraging the Hazara, for example, to support Karzai, despite his Pashtun background. Tehran's links to Ismail Khan, the former Herat governor, were especially strong. However, Iranian officials supported the U.S. and Afghan central government's efforts to subordinate Khan—who acted as Iran's proxy in Afghanistan—to Kabul's authority.
Soft and Hard Power in the Afghanistan Rivalry
Pakistan's Inter-Services Intelligence agency has long supported the Taliban and has aided its resurgence. The rejuvenation of the Taliban bolsters Pakistan's role as a frontline state in the war on terrorism, securing often lucrative assistance from the United States. The Taliban may be a concern to both Kabul and Washington, but Islamabad is more willing to tolerate jihadist violence so long as it is focused outward on Afghanistan, Kashmir, or other parts of India.
While Karzai's government is nominally supported by both Tehran and Islamabad, neither neighbor has been willing to sacrifice its own interests. With time, tension has increased. Iran retains its special interests in Afghanistan's western Herat region, until 1857 part of Iran, and Pakistan considers the Pashto-speaking southern sections of Afghanistan to be within its sphere of influence. Kabul remains a contested area within that sphere. The deterioration in Afghan security, perhaps sparked by one or both, has also created a dynamic of increasing tension between Iran and Pakistan.
Increasingly, as a perception of U.S. weakness spreads, Iran has raised its rhetoric against the presence of U.S. and NATO troops in Afghanistan, which Islamabad nominally supports, at least publicly. Tehran continues to blame the U.S. presence in Afghanistan for continuing instability in the region.
Both Iran and Pakistan have adopted strategies of using soft power influence to provide cover for their more traditional hard power approach vis-à-vis Afghanistan. Though Musharraf committed Pakistan to support efforts to stabilize Afghanistan after the fall of the Taliban and agreed to strengthen the Karzai administration, doubts remain as to Islamabad's capacity and commitment to crack down on terrorists and militants. Kabul is suspicious of Pakistan, on whom its security largely depends. Pakistan's Inter-Services Intelligence (ISI) agency has long supported the Taliban and has aided its resurgence. The rejuvenation of the Taliban bolsters Pakistan's role as a frontline state in the war on terrorism, securing often lucrative assistance from the United States. The ISI and Pakistani military elite also see Pakistan as engaged in a proxy war for influence in Afghanistan. The Taliban may be a concern to both Kabul and Washington, but Islamabad is more willing to tolerate jihadist violence so long as it is focused outward on Afghanistan, Kashmir, or other parts of India. The brazen terror assault on Mumbai in November 2008 that has increased tensions between the two nuclear armed states in the subcontinent is just the latest case of Islamabad continuing to direct Islamist extremism towards its neighbors.
Iran, meanwhile, has taken a multi-pronged approach towards Afghanistan, focusing its economic, social, and educational efforts on the western provinces of Herat, Farah, and Nimruz, perhaps to seek a zone of influence in western Afghanistan and to prevent the West and the Karzai administration from adopting a coherent, countrywide strategy. While Iran has focused its development aid on portions of Afghanistan it considers its near-abroad, Tehran has learned a political lesson from the past and now cooperates with any Afghan group, regardless of sect and language, so long as they oppose the U.S. presence in Afghanistan. The perception that Pakistan and the United States would gain an upper hand in the evolving political environment in Afghanistan has pushed Iran into charting a proactive course towards its eastern neighbor. Iran's strategy toward Afghanistan seems geared toward hastening the withdrawal of U.S. forces, preventing the Taliban from regaining power, and trying to keep Afghanistan under Tehran's sway.
As a result of this policy, some Iranian groups appear to have reached out to the Taliban. U.S. and NATO forces have repeatedly intercepted shipments of Iranian weaponry to the Taliban. The Taliban are already using Iranian-made improvised explosive devices (IEDs) as well as heat seeking missiles and rifles to deadly effect against Western forces. Though the Iranian government has denied any such involvement, sections of the Iranian establishment, in particular the Quds Force, are seen as behind such moves. Several media reports from Afghanistan suggest that Iran has been increasing its operations in Afghanistan in an effort to gain influence with the contending insurgent factions and to hasten the departure of U.S. troops from the country. Growing tensions between Afghanistan and Pakistan are also working to Iran's advantage with Kabul increasingly dependent on Tehran for its transit trade routes. The Karzai government cannot pick fights with both its vital neighbors and so tries to keep Iran in good humor. While Washington maintains that Iran is funneling weapons into Afghanistan, the Afghan government continues to say that Iran is a close friend and ally.
Will a Pakistani-Iranian Rivalry Erupt?
There is little common ground between Iran and Pakistan on a solution to the Afghan crisis, and history may repeat itself with both states once again funding proxy wars between Shi'a and Sunnis in each other's countries as well as in Afghanistan, increasing the likelihood of a major sectarian explosion in the region.
Communities of some five million Baluch tribesmen stretch across southwestern Pakistan and southeastern Iran. Baluchis on both sides of the border feel neglected, on sectarian grounds in Iran and on ethnic grounds in Pakistan, and nationalist sentiments have long simmered, sometimes erupting into open insurrection. While the shah helped the Pakistani army crush Baluch insurgencies in the days prior to his ouster, today insurgency has again erupted with both Pakistani and Iranian officials accusing each other of aiding the insurgents. Tehran has also repeatedly accused the U.S. Special Forces of using their bases in Pakistan to pursue undercover operations inside Iran designed to foment Baluch opposition to the Islamic regime. In June 2008, Jundallah terrorists, an insurgent Baluchi group operating from Pakistan, kidnapped sixteen members of Iran's paramilitary Law Enforcement Forces (niru-ye entezami) and, over the course of months, executed all of their hostages. Tehran blames the Pakistani government for sheltering the group even though Pakistan has also declared Jundallah to be a terrorist organization and, on occasion, Pakistani troops have killed Jundallah terrorists.
Sectarian tension has also complicated relations. In the 1980s, several radical groups sponsored by Pakistani intelligence began a systematic assault on Shi'i symbols and mosques in Pakistan. Pakistani Shi'a, with Iranian assistance, responded by forming their own militias. The continued targeting by Sunni terrorists of Pakistani Shi'a remains an Iranian concern. This Shi'i-Sunni strife in Pakistan has provoked Iran to provide clandestine support to its co-religionists there.
However, Pakistan and Iran have worked to improve security cooperation. In 2001, the two states established the Pakistan-Iran Joint Ministerial Commission on Security to enhance cooperation on security issues such as terrorism, drug trafficking, and sectarian violence. Top Iranian political and intelligence officials regularly engage their Pakistani counterparts, but engagement does not necessarily equate to trust.
The nuclear issue also complicates Pakistani-Iranian ties. Pakistani and Western officials sometimes say that Pakistani nuclear scientist Abdul Qadir Khan operated outside the law when he provided assistance to Tehran's nuclear weapons program; however, evidence also suggests that the Pakistani military was not only aware of Khan's nuclear transactions with Iran but also tacitly approved of his activities. Nevertheless, there remains a sense of rivalry between Islamabad and Tehran on the nuclear issue, given Pakistan's unique position as the sole Muslim country with the bomb. Interestingly, one of the drivers of Iran's nuclear weapons ambitions is fear of a "Sunni bomb." Rumors of an oil-for-nukes pact between Riyadh and Islamabad have exacerbated such concerns. 
An Economic Solution?
Is it possible to ameliorate Iran-Pakistan ties to prevent the development of a dynamic that will undercut Afghan security and, by extension, the safety and security of U.S. and NATO troops present in that country? Here, economics may provide a solution. Trade between Pakistan and Iran remains in the range of $500 million, and both governments hope to double it. Absent much trade, however, political and security tensions will continue to exercise a negative effect on ties.
It is in this context that the impetus comes for the so-called "peace pipeline" that would transport Iranian gas to Pakistan and onward to India. Should the pipeline project come into operation, then trade will become the defining feature of Iran-Pakistan ties. Rising energy demand in both India and Pakistan, at least until the 2008 worldwide recession struck, have led both to consider collaborating on a gas pipeline from Iranian fields through Pakistan to India. Such a pipeline might in theory create mutual economic interests and bring Islamabad perhaps $500 million annually in royalties. However, there has been little progress, largely because of disagreements about pricing and the methods to be used to supply gas to India. India and Iran signed the $22 billion deal in 2005 before Mahmoud Ahmadinejad assumed the presidency and while the crude oil price was low. India considers the pricing deal final while Iranian officials have sought an upward revision in price, arguing that the contract is not valid until the Iranian Supreme Economic Council ratifies it. There are also differences between the national oil companies of Iran and India over the legal interpretation of the contract for the export of five million tons of liquefied natural gas to India.
Both India and Pakistan have contended that Tehran should offer a price for gas in line with global practices for long-term contracts and have rejected Iran's gas pricing formula, whereby the gas price is linked to Brent crude oil with a fixed escalating cost component. The Indian government also argues that it should only pay for gas upon delivery, and opposes Tehran's demand for price revision every three years. The three states decided by consensus to refer the matter to an independent consultant, but Tehran continued to maintain that the consultant's opinion should not be binding, causing tensions among the three parties. As with many pipeline projects, the bickering has led to much recrimination but little construction. Other points of contention include Pakistan's costs for security and transit and U.S. government opposition to any investment in an Iranian project, alongside Iranian worries that tensions between Pakistan and India could disrupt operations and undermine economic viability.
Notwithstanding some tentative recent attempts by Pakistan and Iran to improve their bilateral ties, the two countries' relationship remains strained. Rather than bringing the two states together, the situation in Afghanistan has provided a stage where their rivalry is once again played out. Though the vacuum resulting from the fall of the Taliban government is the main factor behind the rising turmoil in Afghanistan, the problem there also remains a regional one. The more the United States and its NATO allies fail to secure Afghanistan, the more neighboring states will revive their ties to ethnic and ideological proxies, creating a dynamic that will further undermine Afghanistan.
While both Pakistan and Iran seem to have concluded that a stable, independent, and economically strong Afghan state is preferable to a weak and troubled one, they remain very sensitive to their relative gains vis-à-vis each other.
Regardless of who runs Afghanistan, Tehran's and Islamabad's conflicting interests over Afghanistan have played a pivotal role in the formation of their foreign policies toward each other. Afghanistan's predicament is a difficult one. The country may like to enhance its links with its neighboring states, yet, peace and stability will continue to elude it so long as its neighbors view it through the lenses of their regional rivalries and as a chessboard on which to play out the game of their regional power and influence.
In many ways, it is a paradox. The situation in Afghanistan can only improve if Tehran and Islamabad revise their attitudes, but any deterioration in Afghanistan's security situation will instead compound suspicions and force them to prioritize their own security interests in a way which intensifies regional rivalries. Iran will only play a positive role in Afghanistan if it feels its vital interests are not under threat, and a deteriorating security environment in Afghanistan will only make Iran feel more vulnerable, forcing it to take steps to safeguard its interests, letting the conflict spiral further. Pakistan, meanwhile, is reluctant to cede the preeminent position it has enjoyed for the last several decades in determining Afghanistan's political trajectory. And as the security environment in Afghanistan deteriorates further, Islamabad will view this as an opportunity to maintain its presence in its neighbor's territory in order to secure its larger strategic interests.
By no means does this suggest that the United States or its NATO allies should abandon Afghanistan. However, U.S. policymakers should recognize that they are not the only players in the sand box nor that their struggle to stabilize the Karzai regime and battle the Taliban is the only fight going on in the country. Indeed, until there is fundamental change in either Tehran or Islamabad, Afghanistan will remain a crossroad if not for armies, then for their proxies.
Harsh V. Pant is a lecturer in the defense studies department at King's College London and an associate at the King's Center for Science and Security Studies.
 Shahram Chubin and Sepehr Zabin, The Foreign Relations of Iran (Berkeley: University of California Press, 1974), pp. 140-69.
 Mushahid Hussain, "Pakistan-Iran Relations in the Changing World Scenario: Challenges and Response," in Tarik Jain, et al, eds., Foreign Policy Debate: The Years Ahead (Islamabad: Institute of Policy Studies, 1993), pp. 215-9.
 Stephen Cohen, The Idea of Pakistan (Washington, D.C.: Brookings Institution Press, 2004), p. 122.
 Michael Rubin, "Who's Responsible for the Taliban?" Middle East Review of International Affairs, Mar. 2002.
 Ali Mohammadi and Anoushiravan Ehteshami, Iran and Eurasia (Reading, U.K.: Ithaca Press, 2000), pp. 141-5.
 Ahmad Rashid, Taliban (London: Yale University Press, 2000), pp. 203-5; "Pakistan: Haven for Killers," Tehran Times, Feb. 24, 1998.
 Gary C. Schroen, First In: An Insider's Account of How the CIA Spearheaded the War on Terror in Afghanistan (New York: Ballantine, 2005), pp. 43-74; Richard B. Andres, Craig Wills, and Thomas E. Griffith Jr., "Winning with Allies: The Strategic Value of the Afghan Model," International Security, Winter 2005/06, pp. 124-60.
 Alef.ir (Tehran), July 14, 2008.
 The National Security Strategy of the United States of America (Washington, D.C.: The White House, Sept. 2002); John Lewis Gaddis, "A Grand Strategy of Transformation," Foreign Policy, Nov./Dec. 2002), pp. 50-7.
 "Agreement on Provisional Arrangements in Afghanistan Pending the Re-Establishment of Permanent Government Institutions (Bonn Agreement)," United Nations, Bonn, Ger., Dec. 5, 2001.
 "Kabul Declaration on Good Neighbourly Relations," Afghanistan Ministry of Foreign Affairs, Dec. 22, 2002.
 Marvin G. Weinbaum, "Afghanistan and Its Neighbors," Special Report, United States Institute of Peace, June 2006, pp. 12-4.
 Islamic Republic News Agency (Tehran), Oct, 27, 2003.
 The New York Times, Dec. 27, 2006.
 RFE/RL Iran Report, July 8, 2002; The New York Times, Dec. 27, 2006.
 Eurasia.net (New York), Feb. 26, 2002.
 Thomas Johnson, "Ismail Khan, Herat, and Iranian Influence," Strategic Insights (U.S. Naval Postgraduate School, Center for Contemporary Conflict), July 2004.
 Barnett R. Rubin, "Saving Afghanistan," Foreign Affairs, Jan./Feb. 2007, pp. 57-78.
 Manouchehr Mottaki, Iranian foreign minister, "Our Activities Are Legal," interview, Newsweek, Oct. 13, 2008.
 Husain Haqqani, Pakistan: Between Mosque and Military (Washington, D.C.: Carnegie Endowment for International Peace, 2005), pp. 238-60.
 Frederick Kagan, Kimberly Kagan, Danielle Pletka, Iranian Influence in the Levant, Iraq and Afghanistan (Washington, D.C.: American Enterprise Institute, Feb. 19, 2008), pp. 37-56.
 Robert Gates, U.S. secretary of defense, news briefing, Ramstein Air Force Base, Ger., June 13, 2007; The Washington Post, Sept. 21, 2007.
 "… As Afghan Authorities Say 100 Iranian-made IEDs Found," Newsline, Radio Free Europe/Radio Liberty, Aug. 15, 2007.
 Muhammad Tahir, "Iranian Involvement in Afghanistan," Terrorism Monitor (Jamestown Foundation, Washington, D.C.), Jan. 18, 2007.
 The International Herald Tribune (Paris), Aug. 7, 2007.
 Selig Harrison, In Afghanistan's Shadow: Baluch Nationalism and Soviet Temptations (Washington, D.C.: Carnegie Endowment for International Peace, 1981).
 Selig Harrison, "Pakistan's Baluch Insurgency," Le Monde, Oct. 2006.
 BBC Persian Service, June 20, 2008; Alef.ir, July 12, 2008, Dec. 4, 2008.
 The Gulf Times (Dubai), Feb. 15, 2007; Asr-e Iran (Tehran), Apr. 6, 2008.
 Olivier Roy, Globalised Islam: The Search for a New Ummah (London: Hurst, 2002), pp. 35-43.
 Vali R. Nasr, "International Politics, Domestic Imperatives, and Identity Mobilization: Sectarianism in Pakistan, 1979-1998," Comparative Politics, Jan. 2000, pp. 175-87.
 Zahid Hussain, Frontline Pakistan: The Struggle with Militant Islam (London: I.B. Tauris, 2007), pp. 89-101.
 Douglas Frantz and Catherine Collins, The Nuclear Jihadist (New York: Twelve, 2007), pp. 176-9.
 Thomas Woodrow, "The Sino-Saudi Connection," China Brief, Jamestown Foundation, Oct. 24, 2002.
 The Nation (Islamabad), July 25, 2008.
 Sohaib Shahid, "Iran-Pak-India Gas Pipeline: Implications and Prospects," Jang (Karachi), Jan. 15, 2007.
 Dawn (Karachi), Apr. 12, 2007.
 P.R. Kumaraswamy, "Delhi: Between Tehran and Washington," Middle East Quarterly, Winter 2008, pp. 41-7.
 The Indian Express (New Delhi), Nov. 1, 2008.
 Aftab-e Yazd (Yazd), Nov. 3, 2008.
 For greater detail, see Harsh V. Pant, "A Fine Balance: India Walks a Tightrope between Iran and the United States," Orbis, Summer 2007, pp. 495-509.
 Alef.ir, Oct. 5, 2008.
 Seth G. Jones, "The Rise of Afghanistan's Insurgency," International Security, Spring 2008, pp. 7-40.