Nusrat Rahimi, deputy spokesman for the Interior Ministry, said 31 people were wounded in the attack launched from a house near the ceremony. Security forces battled for several hours with militants holed up in the house, Rahimi said, and two insurgents were eventually killed and one person arrested.
The Islamic State group claimed responsibility. The ceremony was commemorating the 1995 death of prominent minority Hazara leader Abdul Ali Mazari, who was killed by the Taliban. Afghanistan's Chief Executive Abdullah Abdullah and former President Hamid Karzai attended the gathering.
Presidential candidate and former Afghan National Security Adviser Hanif Atmar tweeted that eight of his personal guards were wounded and called the attack "horrid and unforgiveable." Another presidential candidate, Latif Pedram, was injured. The extent of his injuries was not immediately known.
Hundreds of people attended the ceremony in a large hall on the western edge of Kabul in the Dasht-e-Barchi neighborhood, said Azizullah Amini, who attended the event. Amini told The Associated Press he heard at least four explosions and that the hall shook as if something was slamming into the ground outside the building. The ceremony quickly ended as people were rattled by the blasts.
IS claimed responsibility for the attack on an affiliated website, saying it targeted a "Shiite celebration attended by senior government officials." The IS affiliate has in the past targeted ethnic Hazaras, a mainly Shiite Muslim minority in Sunni majority Afghanistan. IS has declared war on Shiites, considering them heretics and attacking their mosques and educational institutions.
The militant group has often struck in the Dasht-e-Barchi neighborhood, where Hazaras dominate. The Taliban, by contrast have distanced themselves from attacks on Shiites in Afghanistan. Meanwhile, IS claimed responsibility for an attack Wednesday on a construction company in eastern Nangarhar province that killed at least 17 people and triggered an hours-long gunbattle with Afghan forces, assisted by U.S. troops. The militant group on an affiliated website posted photographs of the two suicide bombers, both Afghan nationals.
The dawn assault started with a suicide bombing outside the gates of a construction company by the airport in Jalalabad, the provincial capital. Afghan officials said a total of five insurgents were involved and that all were killed, including two suicide bombers.
Elsewhere in Afghanistan, the Taliban waged a blistering four-hour battle with security forces on Wednesday night in northern Kunduz province, in the Qalay Zul district, killing seven policemen, according to Mohammad Yosuf Ayubi, chairman of the provincial council. Ayubi said 90 percent of the district is now in Taliban hands.
And early on Thursday, the Taliban killed four Afghan border patrol officers in western Herat province, near the border with Iran, said Gelani Farhad, spokesman for the provincial governor. Attacks have continued in Afghanistan despite stepped-up U.S. efforts to find a negotiated resolution of the 17-year war, America's longest.
U.S. peace envoy Zalmay Khalilzad is currently holding talks with the Taliban in the Gulf Arab state of Qatar, where the insurgents have a political office. The latest round of talks is now in its second week, which has raised expectations that there could be some progress.
Associated Press writer Maamoun Youssef in Cairo contributed to this report.