It was 40 minutes before ambulances arrived to evacuate many of the wounded, he said. Ambulances were seen still coming and going from the wedding palace an hour after the blast, which took place about 6:15 p.m.

“We are still trying to figure how many were killed and how many were wounded,” Mr. Majrooh said.

Muhammad Hashim, 36, a survivor, said the blast occurred as verses from the Quran were being recited to begin the commemoration. “A lot of people were trampled as others were trying to flee,” he said. “There are a lot more than 40 dead in there.”

Nek Amal, 18, was among many who gathered outside the hall seeking news of friends and family members inside.

“My brother is inside and I’ve been trying to reach him but he is not answering the phone,” Mr. Amal said. “He is there with many friends of his and they’re not answering their phones either.”

Wedding halls, mosques and religious gatherings have been particular targets of the Islamic State in Afghanistan, but there was no immediate claim of responsibility for this attack. It was the first major bombing in the capital since an Islamic State suicide bomber struck a wrestling gym in September, killing as many as 30 wrestlers during a training session.

After a period of frequent, gruesome attacks against soft targets in the capital over the summer, Afghan security forces have made it a priority to disrupt Islamic State cells in Kabul, with assistance ordered by the new commander of American and NATO troops in the country, Gen. Austin Scott Miller.

Dozens of suspects were arrested in the capital in September on the eve of Ashura, a Shiite annual commemoration that has frequently been targeted. Officials believe those raids significantly lowered the number of attacks.

The Taliban, still responsible for most of the escalating violence throughout the country, have disavowed attacks on civilian targets. There has been speculation that Taliban insurgents, at least, have been refraining from suicide attacks in the capital as they explore preliminary peace talks with the American government.