KABUL — A suicide bomber attacked a religious gathering Tuesday in the Afghan capital, killing at least 50 Muslim scholars and clerics who had gathered to mark the birth anniversary of the prophet Muhammad, officials said.

The victims included religious delegates from various parts of Afghanistan, Interior Ministry spokesman Najib Danesh said. He said the gathering was convened by the Afghan Ulema Council, the country’s largest religious body, and was attended by hundreds of Sunni Muslims. At least 72 attendees were wounded, the Health Ministry said.

In a statement, President Ashraf Ghani described the attack as “unforgivable and a clear act of hostility against Islam’s teaching.” He declared Wednesday a national day of mourning and ordered that flags be flown at half-staff. The United Nations mission in Afghanistan said it was outraged by the attack.

According to government officials, the bombing was carried out by a lone assailant who targeted the ceremony in a large hall on the first floor of a hotel close to the Interior Ministry, a venue usually used for weddings.

More than 20 of those wounded in the attack were in critical condition, Health Ministry officials said. There were unconfirmed reports about the deaths of a number of top religious figures.

Officials said they feared that the death toll could rise.

One police official said high-grade explosives were used in the blast, which left body parts strewn all over the floor of the hall. The bomber detonated his suicide vest as the scholars and clerics began to recite verses from the Koran, officials said.

“It was the beginning of the function when the blast occurred,” said Shah Mohammad, a witness who helped take casualties to a hospital. “There were bodies all over the place.”

Police were not asked to provide security for the event, a police spokesman said, and the suicide bomber was able to slip into the hall undetected.

Ambulance sirens could be heard in several parts of the capital for hours after Tuesday’s attack. Images on social media showed part of the badly damaged hall of the hotel. Requests for blood donations were announced.

No group immediately claimed responsibility for the attack.

But suspicion immediately fell on the Islamic State, which is considered even more ruthless than the Taliban insurgency that has been battling the Afghan government and its foreign backers for 17 years.

The Taliban “strongly condemns attacks on civilians and sessions of ulema,” or Muslim clerics, Taliban spokesman Zabiullah Mujahid said in a statement sent to reporters.

Without naming any group, but alluding to the Islamic State, he blamed the attack on “seditious circles” that he said have brutally killed Muslims over minor differences. He said this must be prevented.

The Taliban often uses suicide bombings in its own attacks on government and foreign targets and has been blamed for the deaths of thousands of civilians, the United Nations has reported.

In June, at least 14 people, including seven clerics, were killed in a suicide attack in Kabul after leaving a government-sponsored conference of the Ulema Council at which religious leaders from both Sunni and Shiite sects condemned suicide attacks and the militants’ war against the U.S.-backed Afghan government.

The Islamic State claimed responsibility for the June incident, denouncing the meeting of “tyrant clerics” and their condemnation of suicide attacks, according to a website affiliated with the group.

The Ulema Council had issued an unprecedented religious edict earlier that day that said the insurgency in Afghanistan had no religious basis. It also declared that suicide attacks, often used by Taliban and Islamic State insurgents, are “haram,” or forbidden by Islam.

Affiliates of the Islamic State have repeatedly targeted mosques and sites of worship of Afghan Shiite Muslims in recent years. The Islamic State, a radical Sunni group, regards Shiites as heretics.

Earlier this month, a deadly blast targeted a demonstration by hundreds of minority Shiites in the capital. Afghan officials said several people were killed in the Nov. 12 explosion near a high school and close to a gathering of people protesting Taliban attacks on Shiite areas in the Jaghuri and Malistan districts of eastern Ghazni province.

While it remained unclear who carried out Tuesday’s bombing, hard-line Sunnis view venerating the prophet’s birthday as sacrilegious. Although the anniversary is widely celebrated in the Islamic world, it is a holiday that extreme fundamentalists are trying to stamp out.

William Branigin in Washington contributed to this report.