KABUL — An outdoor memorial service attended by numerous Afghan politicians and officials, including Chief Executive Abdullah Abdullah and former president Hamid Karzai, was attacked by mortar fire Thursday in the Afghan capital, killing three people, police and health officials said.

The attack, which also wounded 20 people, was claimed by the Islamic State extremist group through its affiliated website.

The midmorning gathering, which drew several thousand mourners, was being held in a public arena to mark the anniversary of the death of a minority Shiite and ethnic Hazara leader, Abdul Ali Mazari, who was killed in 1995 by the Taliban. 

A year ago this week, a memorial service here for Mazari was attacked by a suicide bomber outside a mosque, killing 10 and injuring 22.

Both attacks took place in southwestern Kabul, the heart of the capital’s large Shiite and Hazara community, which has been the target of dozens of bombings and other attacks in recent years. The 2018 bombing was also claimed by the Islamic State, a radical Sunni group that views Shiites as heretics and has claimed most terrorist attacks on Shiite targets.

Witnesses said Abdullah, 58, who shares executive power with President Ashraf Ghani, was addressing the crowd Thursday when loud mortar fire was heard nearby and people scattered in panic. Abdullah was not harmed.

Ghani, in a statement, called the attack a “criminal act” that showed “enmity toward civil values and democracy.”

Presidential candidate Latif Pedram, 55, a liberal politician and member of parliament, was wounded, but his condition was not immediately known. Eight guards of another presidential candidate, former national security adviser Hanif Atmar, were also injured.

“This was the most horrid and unforgivable attack on civilians by a merciless enemy,” Atmar tweeted several hours after the attack. He said he had arrived home unharmed. “I am pained by the loss of life and injury suffered by so many,” he wrote.

Images from Afghan news broadcasts showed dozens of people fleeing the open-air site as booms could be heard and officials warned from the stage microphone that the event was under a mortar attack.

Residents said two of the three people killed were inside a house near the event that was hit by mortar fire. Officials at the Interior Ministry said most of the rounds landed about 200 feet from the memorial site. The attackers had used another house in the area to launch the mortars at the crowd, the officials said.

The attack revived concern about the Islamic State’s violent agenda at a time when the country has been focused on reaching a peace settlement with the separate, domestic Taliban insurgency. The Taliban has stepped up aggressive attacks in recent months while its representatives have been meeting with U.S. officials to seek an end to the 17-year conflict.

In the past three years, the Islamic State has attacked mosques, shrines, political institutes, education centers and gymnasiums in southwestern Kabul, as well as in Herat and other Shiite-dominated areas, killing hundreds of people. Most of the attacks have been suicide bombings. 

Community leaders have said the Islamic State seeks to provoke sectarian conflict between Sunni and Shiite groups in Afghanistan, but so far it appears to have failed, as religious and political leaders from both sects have condemned the attacks.

However, ethnic Hazara groups have staged protests accusing the Ghani government of failing to protect them. On Thursday, Muhammad Mohaqeq, a senior Hazara leader, told a news conference that “all these episodes either go to the weakness of the government, or the government is collaborating with such circles to use them as a tool . . . against its political rivals.”