A man carrying a knife and a hunting rifle opened fire on worshipers on Sunday at an Orthodox church in Kizlyar, in the Dagestan region of Russia, killing at least five people and wounding several others, according to a Russian state news agency.

The gunman shouted, “Allahu akbar” and began firing, a priest told the local news media. Churchgoers said they had prevented more casualties by closing the door to the church and stopping the attacker from getting inside.

The man was later shot and killed by security forces on duty at the time, reports said. The assailant was identified only as a 22-year-old man from the region, the Russian news agency Tass said.

The Islamic State claimed credit for the attack on the church, issuing a bulletin on its Amaq news agency, followed by a lengthier official statement in which the group described the assailant as a “soldier of the caliphate” and provided a nom de guerre for the attacker, Khalil al-Dagestani.

Not long afterward, pro-Islamic State channels on the Telegram app released a video showing a man said to be the assailant sitting before the Islamic State flag, his face covered by a ski mask. A gun and a long knife leaned against the wall behind him, presumably the weapons that would later be used in the attack.

In the video, the man pledges allegiance to Abu Bakr al-Baghdadi, the Islamic State leader, referring to him as “the Emir of the believers,” the honorific that Islamic State members reserve for the man they view as their caliph.

While the authenticity of the video could not be independently confirmed, Islamic State members and supporters were promoting it online.