KABUL — A suicide bomber killed 14 people Monday outside a large gathering in Kabul during the holy month of Ramadan where top religious figures had just condemned suicide attacks as violations of Islam.

The Islamic State claimed responsibility for the attack on a website linked to the radical group, denouncing the meeting of “tyrant clerics” and their condemnation of suicide attacks.

The attack occurred near the main entrance to a large tented compound in the Afghan capital, where about 2,000 Muslim clerics had assembled to deliberate on the war and attacks by the Taliban and the Islamic State, which are battling the Afghan government as well as U.S. and allied troops.

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

President Ashaf Ghani issued a video statement Tuesday supporting the clerics’ position and condemning the blast as “an attack against the heirs of the prophet of Islam.”

Police said seven of the victims were clerics who had been invited from various parts of Afghanistan by Ghani’s government, which has been seeking ways to make peace with the Taliban with the strong support of the U.S. government and Western donors.

Many people at the meeting had left the tent by the time the bomber detonated his explosives, reducing the potential number of casualties. 

The Taliban distanced itself from the attack. While both it and the Islamic State are battling the government, they differ on tactics and often clash.

The blast occurred after several months of frequent bombings and other attacks, in Kabul and elsewhere in the country. The insurgents have targeted mosques, government ministries, voter identification offices, charities, hotels and police stations.

 While calling out the insurgents’ lethal tactics for condemnation, the council called on Afghan government forces and militant groups to halt the fighting, agree on a cease-fire and hold peace talks.

It was the first time in 17 years of conflict that the nation’s senior Muslim clerics have made such an appeal. Many are deeply conservative Pashtuns who share religious and tribal roots with the Taliban and whose views could carry weight with the insurgents. However, they have much less connection to or potential influence on the Islamic State, a foreign-based extremist group with few Afghan roots. 

Shortly before the attack, a member of the council read an edict, or fatwa, from the group, saying that the war is “illegal according to Islamic laws, and it does nothing but shed the blood of Muslims.”

“We, the religious Ulema, call on the Taliban to respond positively to the peace offer of the Afghan government in order to prevent further bloodshed in the country,” it added.

The fatwa also said that killings by any means, including suicide attacks and crimes such as armed robberies and kidnappings, are sins in Islam.

Enatullah Balegh, a senior council member and adviser to Ghani, told the meeting that clerics also do not support the presence of foreign troops and that religious scholars should form a larger gathering and find a way to end the war.

Pamela Constable in Essex, Conn., contributed to this report.