A suicide bomber has killed at least 27 people at a Shia Muslim mosque in the Afghan capital, Kabul.
Many more were wounded in the blast at an annual Shia ceremony at the Baqir ul Olum mosque in the west of the city.
The attacker arrived on foot and blew himself up among worshippers inside.
So-called Islamic State (IS) said that it was behind the blast. It is the latest of several recent attacks on Afghanistan's Shia community claimed by the Sunni Muslim militant group.
Monday's bombing took place at 12:30 local time (08:00 GMT) during a service to commemorate the death of Imam Hussein, the Prophet Muhammad's grandson and a Shia martyr.
Eyewitnesses said the service was almost over when the bomb was detonated.
Police gave the figure of 27 dead, but the UN Assistance Mission in Afghanistan said 32 were killed and more than 50 injured. Some reports suggest a higher number of wounded.
IS said the attack was carried out by an IS "fighter" but gave no other details on its self-styled Amaq news agency.
"I was inside the mosque and the Mullah was reading the prayer," Ewaz Ali, 50, who suffered minor injuries, told the Associated Press news agency.
"Suddenly a huge explosion happened, then everywhere was dark."
Another worshipper, Nadir Ali, told AFP news agency the blast had created a cloud of dust: "When the dust settled down, I saw the mosque was full of flesh and blood. I was injured in my waist and had to crawl out of the mosque."
Local reports suggested children were among the dead.
There has not been a proper census for more than 40 years, but it is estimated that around 20% of the Afghan population are Shia Muslims - the rest are Sunni. Most Shia Muslims come from the Tajik and Hazara ethnic minorities.
They have been spared levels of sectarian violence seen in Pakistan and Iraq, but they have been targeted at least three times in recent months:
- In an explosion at a mosque in October in the northern province of Balkh in which at least 14 people died
All three attacks were claimed by IS.
Groups affiliated to IS, present in the eastern Afghan province of Nangarhar along the Pakistan border, seem intent on fomenting sectarian violence, says the BBC's Harun Najafizada in Kabul.
What is really worrying is that fragile national unity now seems to be targeted, with possibly devastating results if such attacks continue, our correspondent adds.
Taliban militants were quick to distance themselves from Monday's attack.
"We condemn this blast," Taliban spokesman Zabihullah Mujahid told the BBC. "This act cannot be our work and has nothing to do with us."
President Ashraf Ghani called the attack an attempt "to sow seeds of discord".
Afghan government Chief Executive Abdullah Abdullah urged the country not to fall victim to "enemy plots that divide us by titles".
"This attack targeted innocent civilians - including children - in a holy place," he said via Twitter. "It is a war crime and an act against Islam & humanity."