Afghan President Ashraf Ghani has condemned a suicide bombing which targeted a gathering of hundreds of Islamic scholars in the capital Kabul, calling it an “attack on humanity”.

At least 50 people were killed when a bomber sneaked into a wedding hall where hundreds of people were marking the birthday of the Prophet Muhammad on Tuesday.

Another 83 people were injured, and 20 are said to be in a critical condition.

The attack bore the hallmarks of a local Islamic State affiliate, which has carried out mass bombings targeting minority Shiites as well as perceived supporters of the government.

Afghanistan bombing
Debris at the scene of the attack in Kabul (Rahmat Gul/AP)

Both the Taliban and the IS affiliate want to overthrow the Afghan government and impose a harsh form of Islamic rule. But they are bitterly divided over leadership, ideology and tactics, with the Taliban mainly targeting security forces and government officials.

The Taliban has denied involvement in the bombing, with spokesman Zabihullah Mujahid saying late on Tuesday that his group condemns any attack on civilians or religious clerics.

Mr Ghani declared Wednesday a day of mourning for the victims, as he described the bombing as “an attack on Islamic values and followers of the Prophet Muhammad”.

The UN Security Council also condemned the attack and expressed sympathy to the families of the victims.

Mohammad Muzamil, a waiter at the wedding hall, said he had gone into the back to fetch water for the guests when he heard the explosion.

“Everything was covered with smoke and dust,” he said. “There were dead bodies all around on the chairs, in large numbers.”

Afghanistan
Inside the wedding hall where dozens of people were killed (Rahmat Gul/AP)

Police sealed off roads leading to the scene. Hundreds of family members and relatives gathered at hospitals, looking at lists of those killed and injured that were posted outside.

The Islamic State group claimed a suicide bombing in June that killed at least seven people and wounded 20 at a meeting of top clerics in the capital. The body of religious leaders, known as the Afghan Ulema Council, had issued a decree against suicide attacks and called for peace talks. IS said it had targeted “tyrant clerics” who were siding with the government.

Afghan security forces have struggled to combat the twin Taliban and IS insurgencies since the US and Nato formally ended their combat mission in 2014, shifting to a support and counter-terrorism role.

The Taliban carry out near-daily attacks targeting security forces and government officials across the country, while the IS affiliate has bombed gatherings of minority Shiites, killing hundreds of civilians.