CAIRO — Gunmen said to be from the Islamic State opened fire on a bus carrying worshipers returning from a remote Coptic Christian monastery in upper Egypt on Friday, killing at least eight and wounding 13, said a top religious leader and local officials.

“Terrorists opened fire on a bus carrying people,” Coptic Christian Archbishop Makarious of Minya, a town roughly 150 miles south of Cairo, said in a phone interview. The pilgrims, said community leaders, were returning from a visit to Saint Samuel the Confessor Monastery in a remote patch of Egypt’s western desert.

Six of those killed were from the same family, according to a post on the Facebook page of the Coptic Orthodox Church in Egypt.

On Friday evening, Egypt’s Islamic State affiliate, which has vowed to target the nation’s minority Coptic Christians, claimed responsibility for the attack through its Amaq news service. It was the first attack claimed by the militant group this year outside northern Sinai, where it is fighting Egyptian security forces. In a statement, the militants claimed that they had killed 13 and wounded 18, and that the attack was in response to the jailing of females they claim to be their supporters by the Egyptian government.

Friday’s violence comes more than a year after a similar assault on Christian pilgrims traveling to the same monastery. In May 2017, gunmen attacked buses carrying worshipers, leaving at least 28 people dead. Since December 2017, the last major assault on Christians, there has been a relative lull in the targeting of the Coptic community. Friday’s attack, many fear, could signal the launch of another deadly campaign by the Islamic State against Christians.

President Abdel Fatah al-Sissi on Friday sought to allay the concerns of a community that has staunchly supported him, even as they have been under attack by Islamist extremists for the past two years. Egyptian officials and analysts view the Islamic State's targeting of Christians as an effort to expand beyond their traditional theater of operations in the northern Sinai and foment religious divisions among Egyptians.

“I mourn with deep sorrow the martyrs who were killed today by treacherous hands which aim to undermine the solid fabric of the nation, and I wish speedy recovery for the injured,” Sissi said in a statement. “I confirm our determination to continue our efforts to combat dark terrorism and apprehend the culprits.”

The death toll Friday could have been much higher. There were several vehicles carrying Christian pilgrims, but the militants targeted two buses, said Bishop Aghathon Tala’at, a Christian community leader. One bus escaped when its driver swerved onto another road. But the second bus, carrying at least 20 passengers, was stopped by the militants, who were in two SUVs, Tala’at said in a phone interview.

“A number of masked men got out of them, took the mobile phones of the passengers and then shot all the men dead,” said Tala’at, who is the bishop of Maghagha, a nearby town with a hospital where many of the wounded were treated. “They were wearing militarylike uniforms, survivors told me.”

Images of the bus distributed on social media showed a bloody scene, including a wounded child. The execution-style killings mirror the attack in May 2017 in which gunmen, also dressed in fatigues, killed some victims with single gunshots to the head.

Since 2016, Islamic State suicide bombers in Egypt have targeted churches in Cairo, Alexandria and Tanta, killing scores. Last month, an Egyptian military court sentenced to death 17 people convicted in those attacks. The defendants were charged with belonging to the Islamic State and orchestrating the assaults on the Christian community, which makes up about 10 percent of the population.

Attacks by the Islamic State prompted Sissi’s government to launch a major military operation this year in Egypt’s restive northern Sinai province, the stronghold of the militants. A wave of Islamist militancy has pervaded the country since the military overthrow of the elected president, Mohamed Morsi, and the subsequent crackdown on his Muslim Brotherhood party’s supporters.

The Islamic State has also targeted Sufi Muslims, which the group considers heretics. In November 2017, militants attacked a Sufi mosque in the northern Sinai, slaughtering more than 300 worshipers. It was the deadliest terrorist attack in Egypt’s modern history.

After every assault on the Christian community, Egypt’s security forces bolster security around churches and other holy sites throughout the country. Friday’s violence was an indicator to many that such measures have not worked.

After the attack, Tala’at said, some people angrily took to the streets and blocked a road, demanding better security for their community. The remote area in the western desert, where militant groups have long targeted Egyptian security forces, has poor cellphone reception and unpaved, often unlit roads.

“There has to be a security solution,” Tala’at said. “The road is not paved well, there is not enough lightning, and there is no cell network, either. This is why it is targeted.”