A suicide bomber killed at least 27 people and wounded dozens on Monday in an explosion at a crowded Shi'ite mosque in the Afghan capital Kabul, officials said.

The attacker entered the Baqir ul Olum mosque during a ceremony, the interior ministry said in a statement according to Reuters.

Faridoun Obaidi, chief of the Kabul police Criminal Investigation Department, said at least 27 people were killed and 35 wounded and that the total may rise.

The BBC reports the attacker was on foot and blew himself up among crowds inside the building.

Meanwhile, Pajhwok Afghan News reports that Mohammad Ismail Kawosi, a spokesman for the Ministry of Public Health, said 28 bodies and 45 injured people had been evacuated from the site to hospitals.

The Taliban, seeking to re-impose Islamic law after their 2001 ouster, denied they were responsible for the attack.  “We have never attacked mosques as it's not our agenda,” said the movement's main spokesman, Zabihullah Mujahid.

Government Chief Executive Abdullah Abdullah condemned the attack as a sign of barbarism but said Afghanistan should not fall victim to “enemy plots that divide us by titles.”

“This attack targeted innocent civilians - including children - in a holy place. It is a war crime & an act against Islam and humanity,” he said in a message on his Twitter account.

Bloody sectarian rivalry between Sunni and Shi'ite Muslims has been relatively rare in Afghanistan, a majority Sunni country, but the attack underlines the deadly new dimension that growing ethnic tension could bring to its decades-long conflict, according to Reuters.

Shia, who make up about 15% of the population in Afghanistan, have been attacked several times in recent months.  At least 14 people died in a gun attack on a shrine in Kabul in October.  An attack in July, claimed by so-called Islamic State terrorist group, killed 80 people at a Shia protest march in the capital.