The Islamic State group on Monday claimed responsibility for a deadly attack near a Kabul mosque, hours after the Taliban said they had destroyed an IS sleeper cell in the Afghan capital.
Through its propaganda arm Amaq, the jihadist group said Sunday's attack that killed at least five people was carried out by an IS suicide bomber.
Before the claim, the Taliban's chief spokesman Zabihullah Mujahid told AFP initial information suggested IS-linked groups were responsible.
After overrunning Kabul seven weeks ago the hardline Islamist Taliban have set up an interim Afghan government, but still face attacks from the IS regional branch.
Mujahid said Taliban fighters carried out an operation targeting an IS cell in the north of Kabul on Sunday evening.
The "IS centre was completely destroyed and all the IS members in it were killed," Mujahid said on Twitter.
Witnesses and AFP journalists heard blasts and gunfire in the capital at the time of the raid, and images posted to social media showed a large explosion and a fire at the scene.
Kabul resident and government employee Abdul Rahaman told AFP that a "large number" of Taliban special forces attacked at least three houses in his neighbourhood.
"The fighting continued for several hours," he said, adding the sound of weapons kept him awake all night.
"They said they were after Daesh (IS) fighters in the area," Rahman said.
"I don't know how many were killed or arrested but the fighting was intense."
At the scene on Monday, AFP saw several Taliban gunmen standing guard, denying people access down the road to the property.
Police pick-up trucks could be seen driving towards the site, one of which came back laden with household items including furniture, a carpet and kitchen appliances.
The operation took place within hours of Sunday's blast, which targeted a prayer ceremony at the Eid Gah mosque in memory of Taliban spokesman Mujahid's mother, who died last week.
A government cultural commission official, who asked not to be named, told AFP five people died and 11 were wounded, adding the casualties included both civilians and Taliban members.
"We have also arrested three people in connection with the blast," he said.
Blood trails
According to the official, the device was placed at the entrance to the mosque and detonated as mourners were leaving after offering condolences to Mujahid and his family.
A witness at the mosque, who asked not to be identified, told AFP Sunday's attack at the entrance was carried out by a single suicide bomber.
Just outside the eastern gate, a dark patch was visible on the ground where the explosion took place and bullet holes could be seen in a wall.
The witness said a group of Taliban members -- including senior figures -- inside the mosque grounds came under fire after the blast, taking two casualties.
He added that two Taliban units mistakenly opened fire on each other in the confusion following the explosion, but interior ministry spokesman Qari Sayed Khosti denied there had been any gunfire.
"A suicide bomber detonated his explosives among the crowd killing three people and wounding a dozen," he said.
Trails of blood into the mosque, as well as two red pools where the witness said the injured fighters were treated inside, were seen by AFP reporters on Monday.
The Taliban and the Afghanistan branch of IS -- known as the Islamic State-Khorasan Province, or IS-K -- are both hardline Sunni Islamist militant groups.
But they differ on the issues of religion and strategy, which has led to bloody fighting between the two.
The United Nations in Afghanistan condemned Sunday's mosque attack.
(Except for the headline, this story has not been edited by NDTV staff and is published from a syndicated feed.)
Track Latest News Live on NDTV.com and get news updates from India and around the world