The latest salvo in the battle for extremist allegiance between the Taliban and the Islamic State (IS) arrived today in the form of a strongly worded letter.

In cautioning IS to back off in Afghanistan, the Taliban wrote that if the two militant groups were to become rivals in the country, decades of fighting foreign powers and the Afghan government could be undone.

"Jihad against the American invaders and its puppets should be carried out under a single flag, a single leadership, and a single order," read the letter signed by deputy Taliban leader Mullah Akhtar Mohammad Mansour and addressed to IS leader Abu Bakr al-Baghdadi and his followers.

The letter, which was released Tuesday in several languages, told Baghdadi that he shouldn't "from far away make such decisions" that would threaten the integrity of the "Islamic Emirate," a term the Taliban uses to refer to its territory. The Taliban further threatened to "show its reaction against" the Islamic State should it not heed the Taliban's words.

Though experts say it is unclear how many resources IS has devoted to Afghanistan, in January the group declared the country, along with Pakistan, to be part of its "Khorosan" province, leading militants in both countries to swear allegiance to its self-declared caliphate and carry out attacks in its name.

In March, the UN's special envoy to Afghanistan told the Security Council that the UN mission there estimated that the Islamic State's "presence is of concern, but that [its] significance is not so much a function of its intrinsic capacities in the area but of its potential to offer an alternative flagpole to which otherwise isolated insurgent splinter groups can rally."

Since that assessment, fighting between the Taliban and IS fighters has been reported in several parts of Afghanistan. In May, a truck bomb exploded in the southern Zabul province during clashes between the two groups, reportedly leaving 11 dead. Earlier this month, the Afghan army said IS had beheaded 10 Taliban prisoners captured during battle. Fighting continues in and around Jalalabad in Nangarhar province, whose "shadow" Taliban governor was assassinated in Pakistan last week.

The stepped-up rivalry has also coincided with attacks on religious minorities on both sides of the border, who are seen as easy targets. In February, shortly after they reportedly switched allegiance to IS, two former Taliban commanders oversaw the kidnapping of more than 30 men and boys from Afghanistan's mostly Shia Hazara minority.

Analysts say IS is still a relatively minor force in Afghanistan, but IS appears to represent an insurgency within the Taliban's own decades-long insurgency — and brief rule — in the country, and its claim to ideological authority.

"I think the Taliban is a little frustrated, because they've been doing 99 percent of the fighting for decades," Patrick Skinner, director of special projects at the Soufan Group, which tracks extremists, told VICE News.

[ooyalacontent_id="hud21udDqpxJ5PQrebkzdwAZ-eHbWBbW"player_id="YjMwNmI4YjU2MGM5ZWRjMzRmMjljMjc5" auto_play="1" skip_ads="0"]

VICE News' 'The Islamic State'

The Taliban has long enjoyed an alliance with al Qaeda, which until the Islamic State's rapid ascension last year was seen as the top dog among international terrorist organizations. Making matters worse for the Taliban, its top leadership is increasingly fractured, leaving it a ripe target for IS — formerly known as ISIS — a group that espouses fighting on a global scale and that has embraced social media.

"People want to join ISIS because they are the hot brand right now," Skinner said. "The Taliban is the exact opposite of that; they just run their individual provinces or villages." The Islamic State "can steal their thunder" at a time when NATO troops are leaving Afghanistan, he added.

In April, the Taliban released a glowing biography of its longtime leader Mullah Omar — a move that many tied to the growing influence of IS — citing among other things his credibility among religious scholars in Afghanistan. In Tuesday's letter, the Taliban doubled down on that hagiography, writing that Omar and the Taliban "have given countless sacrifices for the freedom of Afghanistan from the occupation of invaders and to bring Islamic rule."

However, Omar has not been seen publicly in more than a decade, and doubts swirl among even members of the Taliban that he remains alive. Some of those in Afghanistan who have thrown their lot in with IS are believed to be members of the Taliban who have grown frustrated with its leadership.

Unlike IS, which controls large swaths of territory in both Iraq and Syria, and which has fielded allegiances from militants in a half dozen other countries, the Taliban has always been primarily focused on Afghanistan and the border regions of Pakistan. As Taliban leadership countenance peace talks with the Afghani government, IS offers fighters the flag of its caliphate — and an ideology of expansion.

In its letter to Baghdadi, the Taliban attempted to address that disparity, saying that it too had global reach.

"The Islamic Emirate has been firm on its position since the first day and so far has the sympathy of all Muslims around the world," the letter read. "Therefore no necessity according to Sharia is seen to establish a parallel rank in Afghanistan."

The Taliban may also wish to avoid the attention of the international community, which is currently transfixed by IS elsewhere.

"They prefer to fight the Afghan national police and the army," Skinner said. "But if ISIS starts getting really active, then that will invite international attention, and the Taliban doesn't want that. Right now the ISIS presence is more aspirational and propaganda than actionable. But that doesn't mean it can't change."