Not a while ago, Foreign Affairs magazine ran an article on the growing ties between Iran and the Taliban. Ahmad Javid, the author of the article, points out to a number of reports that document Iran’s ongoing effort to recruit and train Taliban fighters. Iranian policy in this regard, according to Ahmad Javid is alarming.

Of course, it is not as if this is the first time Iran is meddling in the internal matters of other countries. Earlier on two occasions, the international forces in Afghanistan did seize shipments of Iranian ammunitions and weapons en route to Afghanistan. Ahmad Javid argues that the shipments in 2007 and in 2011 were big enough, therefore the Iranian authorities must have known about them. Commenting on Iran’s policy, former US Army general David Petraeus believed that Iran was not oblivious to the fact that its help to the Taliban would not change much but Iran sought to make the American task in Afghanistan a difficult one.

Iran has been driven by its security concerns. In fact, the objective is primarily to make the Americans bleed rather than to help the Taliban return to power. In the past, Iran opposed the Taliban rule in Afghanistan lest Taliban joined forces with Jundallah, a Sunni militant group that operates inside Iran. In 1998, Iran was about to launch an attack against the Taliban. Moreover, Iran supported the United States’ effort in 2001 to bring down the Taliban regime.

All along, Iran remained opposed to any reconciliation between Taliban and the Afghan government. But Iran changed this policy in 2011 and became supportive of peace talks after the appointment of Burhanuddin Rabbani to chair the Afghan High Peace Council, a new body tasked with facilitating talks with the Taliban, but remained opposed to any direct US talks with the militants.

Iran’s meddling in Afghanistan has been designed to offset the United States. The new security arrangement between the Afghan government and the United States, whereby the United States can maintain military bases close to Iran’s borders, has set alarm bells ringing in Tehran particularly among the hard-liners. Against this backdrop, Iran changed its strategy in Afghanistan.

Seen in this way, Iran is most likely to maintain its support to the Taliban for years to come so as to ensure failure of the United States but not to help them return to power. Additionally, by assisting the Taliban, Iran seeks to have influence over this group in case the Afghan government and the Taliban reconcile in the years to come. In his article, Ahmad Javid makes the case that Iran’s sophisticated strategy of embracing certain Taliban groups has made Iran effectively “both a peacemaker and a spoiler.”

There is another component of Iran’s strategy in the region as a whole. Over the last two years, Iran has also been alarmed by the emergence and rise of the so-called Islamic State or Daesh. The latter has made spectacular gains in various parts of the region. For Taliban, Daesh has been recruiting some of Taliban’s supporters. In other words, Daesh is eyeing both Taliban supporters and its funds. Therefore, Iran seeks to exploit the competition between the two Sunni militant groups. In fact, Iran’s relationship with the Taliban is also designed to counter influence of Sunni groups in the region. It is known that many of Taliban figures prefer Daesh to the Taliban who, according to them, is serving Pakistan rather than Islam. Some Taliban fighters made it perfectly clear that they found Daesh as a better vehicle for them to realize their Islamic ideals.

Iran is expected to continue its current policy in Afghanistan as the best strategy to deal with the multiple security concerns. The ruling elite in Iran and its supporters thinks that Iran has some legitimate stakes in Afghanistan. Hence, Iran is right to embrace the Taliban as a part of a wider regional strategy. To be sure, Iran does not trust the Taliban. In fact, Tehran may change course in the future to suit its interests.