Image caption There have been serious clashes between Afghan militants allied with Islamic State and Taliban fighters

A senior US commander in Afghanistan has said that fighters allied with Islamic State (IS) are in contact with the militants' Syrian headquarters.

Gen Sean Swindell, leader of the unit training Afghan special forces, said that disgruntled Taliban fighters have established a "franchise".

But he added that IS in Afghanistan is not as serious as in Libya or Iraq.

There have been serious clashes between the new group and the Taliban in eastern Afghanistan in recent weeks.

IS threats

Both sides have ignored appeals for unity and the fighting has spread across several districts in Nangarhar province, not far from the Tora Bora cave complex where former al-Qaeda leader Osama Bin Laden once hid.

Part of the website of the main IS group is now reserved for material about "IS in Khorasan", using an old name for Afghanistan.

A recently posted statement threatens Taliban fighters with death if they do not join IS.

"Why are you fighting with the Islamic State? Do you want to dig your own grave? Do you want to be beheaded, and have your homes destroyed? Do you think you are stronger than those Iraqi militias behind whom the Americans are standing?" it says.

Image caption The Taliban have written to the IS chief, appealing for unity between the two groups

The statement appears to be a rebuff to a direct appeal by the Taliban for unity between the two groups.

In a statement to IS leader Abu Bakr al-Baghdadi, the Taliban said that there could not be "two flags" in the insurgency in Afghanistan.

It said that it would "result in mujahideen strength being fragmented."

But in contrast, during their offensive in Nangarhar, IS supporters have been seen urging people to kill the leader of the Taliban, Mullah Mohammed Omar.

They argue that there is already one caliph - Baghdadi.

Security challenge

The first signs of "IS in Khorasan" were in Pakistan's frontier region in January.

A number of ex-Taliban fighters, including one Afghan commander, pledged allegiance to the new group.

Now, backing up IS threats, pictures of Taliban fighters being both beheaded and shot have appeared on social media in Afghanistan and Pakistan.

The new battles are a complex security challenge for Afghan forces in their first summer of fighting without international combat support on the ground.

Image caption The Farah province in the west is also facing threats from the IS "franchise"

Gen Swindell said that Afghan special forces are conducting around 130 raids a week.

Only in a handful was there direct support by international troops. Even then, it was not in a combat role but involved advising in command and control centres.

Gen Swindell said that Farah province in the west is also facing threats from the new movement. They were in a "competition for resources" with the Taliban.

The fighting has led to renewed misery for Afghan civilians caught between the two sides.

Thousands of people have fled their homes to avoid the fighting in Nangarhar.

This year has seen more than 4,200 civilians killed or injured across the country. It look as if it will set a dismal new record of the highest casualties by the end of the year, topping even 2014.