In 1998, Iran was hours away from invading Afghanistan after the Taliban killed 11 senior Iranian diplomats in the northern city of Mazar-i-Sharif. Iranian General Qasem Soleimani, who led the elite Quds Force for decades, had waged a proxy war against the Pakistani-backed Taliban for much of the 1990s, so he knew it well.
Years later, American diplomats confirmed that Soleimani had helped them oust the Taliban by providing key intelligence and tactical support; such was the animosity. But that was then. Today, it is highly unlikely that the US and Iran would work together in this way.
Three decades on, Iran is increasingly cooperating with the Taliban, which has turned on its former backer, Pakistan. For their part, Russia and China also have an interest in Iran working in concert with Afghanistan, as this forms an anti-American nexus spanning central and southern Asia. Tehran’s relationship with Kabul may be a marriage of convenience, but it has given the Iranians strategic depth. To understand how Iran and the Taliban became partners, one must explore Iran’s long-standing links to al-Qaeda.
Around 2010, top American generals began accusing Iran of supporting the Taliban insurgency against the NATO forces in Afghanistan. Although the Taliban was nurtured, sheltered, and armed by Pakistan’s intelligence service (ISI), Islamabad began to lose control over the group it had supported. Iran and Soleimani were beginning to outsmart both the ISI and the CIA.
Although Soleimani and the IRGC had helped the Americans topple the Taliban, Tehran and Washington were at odds over how Afghanistan should be governed. The disagreement related to Iraq (where Soleimani had also helped the Americans get rid of Saddam Hussein). They also differed on how Iraq should be run, and by whom.

