KABUL, Afghanistan—A suspected Islamic State suicide bomber struck a meeting of Afghanistan’s top clerics and religious scholars in the capital on Monday, killing 14 people shortly after the large gathering declared such suicide attacks a sin and the country’s 17-year war illegal under Islamic law.

The Afghan branch of Islamic State said through its Amaq news agency that it carried out the attack, which occurred as the meeting of the Afghan Ulema Council was adjourning and attendees were departing the assembly grounds. The...