The Afghan Taliban say they have unleashed "special forces" in an increasingly bloody battle with fighters from the rival, so-called Islamic State (IS) group. The Taliban's dominance and monopoly on insurgency in a region home to numerous local and foreign militant groups is being challenged by IS, which has been gaining some support. Who's winning the war of the militants?
How many Taliban special forces are fighting Islamic State?
According to Taliban sources, the special task force, part of the Taliban's special forces command, was set up in early October and has more than 1,000 fighters - better equipped and trained than regular Taliban and with the sole aim of crushing IS.
Special ops teams are handpicked for their fighting skills and experience and are active in all provinces where IS has a current or potential presence - including Nangarhar, Farah, Helmand and Zabul. But Taliban special forces will deploy anywhere against IS, leaving other Taliban to fight Afghan and foreign troops.
Have many insurgents been killed?
When IS planned its expansion into Afghanistan, the Taliban quietly ordered their commanders to confront the group by "all means possible". Since April, the Taliban and IS have attacked each other many times as they try to hold or take territory. IS cells, mostly led by disgruntled ex-Afghan Taliban commanders - as well as some militants from Pakistan and Uzbekistan - have been targeted.
Nangarhar, Helmand, Farah and Zabul provinces have seen most of the fighting, with hundreds of insurgents from both sides killed. Exact figures are not available but Taliban special ops units are thought to have killed dozens of IS fighters since October.
For their part, IS has also killed dozens of Taliban, mainly in Nangarhar. They seek out Taliban whenever they can and have ambushed them many times. IS beheaded 10 Taliban fighters earlier this year in Nangarhar.
In June, the Taliban shadow governor for the province, Mawlawi Mir Ahmad Gul, was assassinated in Peshawar. It was believed that IS was behind the attack.
For the time being, it seems that IS has been largely eliminated in the south and west of the country. But its small groups of fighters are active in eastern Afghanistan, especially Nangarhar and Kunar provinces.
IS is also focusing on northern Afghanistan where it wants to establish pockets to link up with other Uzbek, Tajik, Chechen and Uighur militants and cross international borders with ease.
When did the two movements start fighting?
The two groups declared war on one another in January 2015 after IS announced the establishment of its branch in "Khorasan", an old name for Afghanistan and parts of neighbouring Pakistan, Iran and Central Asia. It was the first time that Islamic State, which has its roots in the conflicts in Iraq and Syria, had officially spread outside the Arab world.
IS, or "Daesh" as it is known by its Arabic acronym, was the first major militant group to directly challenge the authority of the Taliban's founder, Mullah Muhammad Omar, who was regarded by the Taliban as Amir-ul Momineen (Leader of the Faithful) of the Islamic Emirate of Afghanistan.
Al-Qaeda's leaders were given shelter by the Taliban leader and they had acknowledged his authority. But IS has been vocally opposed, with statements and propaganda videos questioning the legitimacy of the Taliban and accusing them of promoting the interests of Pakistan's ISI intelligence agency.
The Taliban hit back, telling the IS to stop "creating a parallel jihadist front". In an open letter to IS leader Abu Bakr al-Baghdadi dated 16 June, the Taliban warned they would be compelled "to defend our achievements".
The IS response a week later, from its central spokesman Abu Muhammad al-Adnani, specifically mentioned opponents in Khorasan, Libya and Syria and accused them of committing a religious crime. IS fighters were ordered to "have no mercy or compassion" for those who didn't "repent" and "join the Caliphate".
How serious is this for the Taliban?
The Taliban's dominance has never been so directly challenged by other militants. Now their worst nightmare is a large-scale defection of their cadres to IS. To prevent this they have been confronting their new enemy on two fronts - militarily and ideologically.
Islamic State is running an aggressive recruitment campaign and mainly targets militant commanders who have been expelled or sidelined. It has been exploiting the internal power struggle within the Taliban that became more visible when Mullah Akhtar Muhammad Mansour was appointed as the new leader after the death of Mullah Omar was announced in July. Last month a breakaway Taliban faction was formed, further complicating matters - it says it is also against IS.
The vast monetary resources enjoyed by IS have been a lure too. Many, especially the young unemployed, have been attracted by salaries as high as $500 a month. IS's future in Afghanistan is also closely linked to the fortunes of IS in Iraq and Syria, where it has taken swathes of territory. But many militants are in a "wait and see" phase or are too scared of the Taliban's harsh reprisals to make their allegiance to IS public.
Elements in Pakistan's powerful military, who are accused of backing the Taliban, will have an important role to play in how things pan out.
Islamic State versus Islamic Emirate
There are several ideological and cultural differences between the two groups.
IS is a pan-Islamist organisation, has an agenda of borderless global jihad and aims to establish a single political entity consisting of all Muslim countries and territories.
The Taliban insist their agenda is local, confined only to Afghanistan. Their stated aim is to free Afghanistan of "foreign occupation" and the full and immediate withdrawal of all foreign forces from the country.
By declaring the Caliphate, Abu Bakar Al-Baghdadi claims the allegiance of all Muslims. A video posted by the IS's Khorasan chapter in late May categorically says that there cannot be two Caliphs in the world and in the presence of the eligible one, the other Caliph needs to be eliminated.
There are theological differences too. The Taliban is a conservative clerical movement loyal to the puritanical version of the Hanafi school of Sunni Islam, practised by the vast majority of Sunni Afghans. They generally believe in Sufism and have tended to avoid anti-Shia sectarian violence.
IS, which subscribes to the ideology of the more austere Wahhabi/Salafi branch of Sunni Islam, does not believe in Sufism and regards Shias as non-believers. While announcing the establishment of its Khorasan chapter, IS said that the aim was "to impose Tawhid (monotheism) and rout Shirk (polytheism)", a reference to traditional Islam in which Sufi saints are venerated and shrines visited.
The Taliban's religious scholars have also issued fatwas (religious edicts) against IS's legitimacy and ideology and justified fighting against it on religious grounds.
What about drone strikes?
Such attacks have been a serious setback for the newly-recruited IS militants in Afghanistan. The group appointed Hafiz Saeed Khan (a former Pakistani Taliban commander) as its "Khorasan governor" and Abdul Rauf Khadem (a prominent former Afghan Taliban commander) as his deputy. But just two weeks after his appointment, Khadem was killed in a US drone strike on 9 February in Helmand. A few days later, his successor was also killed in a similar strike.
In early July, another key IS commander - formerly a Pakistani Taliban commander - and the group's local spokesman, Shahidullah Shahid, were killed in a US airstrike in Nangarhar province.
A few days later, the Afghan intelligence agency announced that Hafiz Saeed Khan had been killed along with 30 fighters in a "co-ordinated" drone strike in Nangarhar. The group denied the killing but has not provided credible evidence that he survived. Over the past year, up to 1,000 IS-linked fighters have been killed in US drone strikes and in fighting with the Taliban, statements by Afghan officials and media reports suggest.
How scared are Afghans of IS?
In some cases Islamic State fighters have come up with harsher and more elaborate ways of punishing and killing their opponents than their counterparts in the Middle East - particularly in Nangarhar province, their de facto "capital".
One video in particular, released in August, created horror and fear throughout the country.
It showed IS fighters herding 10 blindfolded people, including old men, to a hillside in Achin district, who were forced to sit on the ground on top of holes already filled with explosives.
The video titled "monotheists take revenge on Apostates 2" also shows the aftermath, including flying ripped up body parts and dirt.
In some parts of Nangarhar province, IS told villagers to provide wives for the newly recruited fighters and banned the smoking and selling of cigarettes. Narcotics, including the cultivation of opium poppies, were also banned. In December IS launched a local FM radio station in Nangarhar as part of its propaganda to attract more recruits.
IS fighters have looted and burned hundreds of their opponents' houses and taken over others that had become vacant.
While IS's ideology and the announcement of the Caliphate has attracted recruits in South and Central Asia, its brutal tactics have also alienated many in the region.
The emergence of IS in Afghanistan poses a serious challenge to the Taliban's supremacy. But it has also helped them in many ways. Taliban leaders have already opened dialogue with several regional countries, assuring them that they would not allow IS to gain a foothold in Afghanistan and threaten their stability.
States such as Iran, China and Russia have had to review their old policies of non-interaction with the Afghan Taliban.
The Taliban are now fighting against two enemies - Islamic State and the Afghan government and its international allies (as well as the breakaway Taliban faction).
IS is finding it hard to become a major force in the already congested militant market - but if it were to, it would not only fundamentally change the insurgency, but also mark the end of any hopes for a peace process in Afghanistan.
Instability in the wider region would increase.
Unless regional states implement a joint plan to bring stability, the prospects for the region look grim.