Afghan policemen stand guard near the site of an attack in Kabul, Oct. 11, 2016. (Mohammad Ismail/Reuters)

The Islamic State claimed Wednesday it masterminded an attack on Shiite worshipers in Kabul that left at least 17 people dead during events marking one of the holiest days for Shiite Muslims.

The Amaq news agency, an Islamic State-linked media wing, asserted that the group was involved in planning Tuesday’s bloodshed and said an Islamic State fighter was among the gunmen, according to the SITE Intelligence Group, which monitors extremist websites.

The claim could not be independently confirmed, but the Islamic State has tried to expand its footholds in Afghanistan and has carried out previous attacks against Shiites in Iraq and elsewhere.

At least 62 people were wounded, including 12 policemen, during the battles at Kabul’s Sakhi shrine, a domed hillside sanctuary is one of the most popular places for Shiites to gather on holidays.

Police said that at least three attackers were involved, wearing police or military uniforms, and that they may have set off explosions before the gunfire.

A video posted on social media showed the shrine’s massive tiled dome illuminated by bursts of gunfire, with sounds of screams and wailing in the background.

Officials remain on high alert Wednesday, during Ashura, a major holiday in Shiite Islam, in the month of Muharram, when Shiite men ritually flagellate themselves in the streets as a sign of mourning. The Ministry of Hajj and Religious Affairs had asked people not to congregate in large numbers or cover their car windows with paint, a common practice during Muharram that could potentially hide attackers.

Five years ago, suicide bombers attacked another Shiite shrine in Kabul on the same day, known as Ashura, killing more than 50 people, and bombs were also detonated at mosques in two other Afghan cities. That series of attacks was claimed by a violent Sunni sectarian group based in Pakistan that is officially banned. 

Officials were also worried about the potential for violence because of a recent bombing in the west Kabul community of ethnic Hazara Shiites. On July 23, bombers attacked a peaceful protest there, killing more than 80 people. The attack was claimed by a regional affiliate of the Islamic State.

Ashura is an emotionally charged day of mourning on which all Muslims, but especially Shiites, commemorate the death of Imam Hussein, a grandson of the prophet Muhammad, who was killed in a battle in A.D. 680 in what is now Iraq. It has also become an increasingly bold statement of religious identity by Hazara Shiites. 

All week, excitement and tension have built in the community, with loudspeakers blaring rhythmic dirges, and thousands of brightly colored flags rippling in the streets and affixed to caravans of honking cars. Food and drink have been given away at dozens of stands draped in black, and giant black paper portals have been erected along many streets.

Security volunteers from local mosques have kept a watchful eye on crowds roaming the streets and have sometimes searched bundles and purses. On Monday, one volunteer urged a reporter not to stop and interview people because it could create a target for attack.

In Afghanistan’s Muslim society, the Shiite minority makes up about 30 percent of the populace, and relations with the Sunni majority have historically been amicable. But Shiites were suppressed during Taliban rule in the late 1990s, and the rise of radical sectarian groups such as the Islamic State has also created tensions.

Shiite Hazaras, historically ostracized, have bounded back under democratic rule since 2001, flexing increasing political and religious muscle. In the past year, a Hazara group called Enlightenment has demanded more services and justice for the community and held numerous rallies. It was one of its rallies in July that was bombed by the Islamic State.

CORRECTION: An earlier version of this article misstated that Ashura, a major holiday in Shiite Islam, was the final day of the month of Muharram. It is actually the 10th day.

Brian Murphy in Washington contributeed to this report.