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.

Fraidoon 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.

Source: b'Afghan security forces keep watch in front of a mosque where an explosion happened in Kabul, Afghanistan/Source: Reuters'

"I saw people screaming and covered in blood," a survivor told Afghanistan's Ariana Television. He said around 40 dead and 80 wounded had been taken from the building before rescue services arrived at the scene, but there was no independent confirmation of those figures.

The Taliban, seeking to reimpose 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.

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.

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 & humanity," he said in a message on his Twitter account.

In July, more than 80 people were killed in an attack on a demonstration by the mainly Shi'ite Hazara minority that was claimed by Islamic State militants.