In the days after a United States drone strike killed Iran’s top intelligence and military operative, President Ashraf Ghani of Afghanistan scrambled to keep his country out of a cycle of escalation between the two powers.
Now that Iranian missiles have come into play, some of the particular vulnerabilities of Afghanistan, which lies along Iran’s northeastern border and still hosts about 13,000 American military personnel on a network of bases, are on display.
“The government of the Islamic Republic of Afghanistan assures the people and its neighbors that, according to the security agreement with the United States, the territory of Afghanistan in no circumstances will be used against another country,” Mr. Ghani said in one statement. His aides say he reiterated that message in calls with President Hassan Rouhani of Iran and with Secretary of State Mike Pompeo and Defense Secretary Mark T. Esper.
The Afghan leader’s concerns arise from the fact that President Trump in recent days warned that Iranian retaliation for the drone strike that killed Maj. Gen. Qassim Suleimani would be met by heavy force. Two United States military officials, speaking on condition of anonymity to discuss operations, said the American air assets in Afghanistan have repeatedly come up in discussions over potential responses to Iran, though the top United States commander in Afghanistan has urged caution about such plans.
Along with a border, Afghanistan shares complicated and extensive political, cultural and economic ties with Iran.
Throughout decades of war and upheaval, millions of Afghan refugees fled to Iran, where a large Afghan population remains.
Even during 18 years of a United States presence in Afghanistan, which Iran sees as a threat to its security, the Iranian government has largely taken a pragmatic approach.
It is very engaged with the American-backed Afghan government, and has been a source of some economic support — and, covertly, of bags of cash to influential Afghans — even when its own economy has ailed. But it has also maintained communications with some cells of the Taliban insurgency, betting that the Taliban will outlast the American military presence.
The depth of Iran’s importance to Afghanistan was made clear in the public reaction of some of Afghanistan’s most influential political leaders after the killing of General Suleimani, a hardened security operator who spoke with many Afghan officials over the years and who sent thousands of Afghan refugees to fight on Iran’s side in the war in Syria.
Former President Hamid Karzai, who came to power after the American invasion and was supported by the United States during his 13 years in office, called General Suleimani a “man of dignity” as he condemned the United States’ strike against him. Mohammed Hanif Atmar, a former Afghan national security adviser who put his signature to the strategic security agreement between Afghanistan and the United States, spoke glowingly of the general as a martyr.
Even Abdullah Abdullah, the chief executive of the current United States-brokered government, went to the Iranian Embassy to pay his condolences and sign a memorial book laid out for General Suleimani, officials said.
Richard Olson, a former United States special envoy to Afghanistan, said that despite the high number of potential American military targets in Afghanistan, Iran would be more likely to strike elsewhere — possibly Iraq, Syria or Lebanon, where Iran has tighter control over proxy forces.
Instead, any American reaction launched from Afghan soil might put more pressure on Afghan officials than any demands by Iran, Mr. Olson said.
“If we get into a prolonged, low-intensity conflict with Iran — which I think is likely, unfortunately — then the U.S. may get to thinking that we are going to need to stay in Afghanistan and maintain a relatively robust military presence to threaten Iran from the rear,” he said.
“If we reach that decision,” he added, “then I think that pretty much means the end of the peace process in Afghanistan.”
Mr. Olson was referring to renewed talks between the United States and Taliban representatives in Doha, Qatar, aimed at negotiating an American military withdrawal and the eventual opening of direct talks between the Afghan government and the insurgency.
Two Western diplomats aware of the peace process said that the United States’ strike against Iran, and Iran’s retaliation in Iraq, will surely slow down the talks, as the Taliban try to grapple with what this means for their insurgency.
While some analysts believe that the elements of the Taliban close to Iran will now feel pressured to deliver on Iran’s behalf, the diplomats said they hoped the Taliban would try to avoid being dragged deeper into another conflict at a time when they were so close to a deal.
During the upheaval of the 1990s, when the Taliban came to power in Afghanistan, the Shiite theocracy in Iran saw the group as an enemy force that oppressed Afghan Shiites and was hostile to Iran.
But while the United States was spending hundreds of billions of dollars in Afghanistan, and cycling nearly a million American troops through in the 18 years of war, Iran changed its policy, deciding to nurture the Taliban when it was useful. General Suleimani was central to that effort, according to United States and Afghan officials, which has given Iran a hedge against the United States in Afghanistan at very little cost.
Those officials say that in some cases, Iran has simply given Taliban leaders and their family members a refuge from American and Afghan forces, hosting them in Iran. One Afghan official said that General Suleimani made a point of allowing the smuggling networks that help finance the Taliban to pass unimpeded through Iran.
In other cases, Iranian support for the insurgency has been more significant. Afghan and Western officials say they know of Taliban offices in several Iranian cities. And the Taliban’s former supreme leader, Mullah Akhtar Mohammad Mansour, had started making trips to Iran from his base in Pakistan. He was returning from one of those tripswhen a United States drone strike killed him in 2016.
With many of the Afghan leaders, General Suleimani had a history that reached back decades.
General Suleimani had a high profile within Afghanistan, and visiting Afghan officials often met with him in Iran.
American officials, too, were keenly aware of General Suleimani’s interest, as some of the generals who have come to Afghanistan to lead had at other times crossed swords with General Suleimani elsewhere.
Before taking command in Afghanistan, Gen. Austin S. Miller was in charge of the joint special operations command leading missions in places like Syria, Iraq, and Yemen. General Miller’s predecessor in that role had described General Suleimani as his “peer competitor.”
But if things continue to escalate between the United States and Iran, Afghan and American officials fear that more active Iranian intervention could change the battlefield in Afghanistan.
One major concern is whether Iran might now begin providing more sophisticated weaponry to the Taliban — particularly the kind of portable antiaircraft missiles that over 18 years of fighting had not been a factor that American and Afghan officials had to face in fighting the insurgency.
After the killing of General Suleimani, a former Afghan intelligence chief, Rahmatullah Nabil, said on Twitter that it would be “no surprise” if such missile technology made its way into Taliban hands if a peace deal were to fall through.
But diplomats suggest the Taliban might be too rational to be dragged into such an escalation on the verge of a peace deal with the United States — unless they conclude that the United States is not leaving Afghanistan and needs to be forced out.
Thomas Gibbons-Neff contributed reporting from Washington.