CAIRO — Islamic State militants killed at least eight policemen in an attack on a checkpoint in Egypt’s volatile northern Sinai Peninsula on Wednesday, the Interior Ministry said in a statement.

The assault was the latest sign that the Islamic State’s Egypt affiliate continues to pose a threat to the country’s security forces despite a highly touted and intense campaign by the military since early 2018 that has, for the most part, managed to stop large-scale attacks by Islamist militants.

The violence Wednesday came in the early morning near the northern Sinai city of Arish as Muslims were holding prayers to usher in the Eid al-Fitr holiday, which marks the end of the Muslim holy month of Ramadan.

According to the Interior Ministry statement, two police officers and six conscripts were killed in the attack, while media reports, citing unnamed officials, said there were 10 police fatalities. The Islamic State’s Amaq News Agency said the group was responsible for the assault.

After the attack, Egyptian security forces pursued the militants, killing at least five, the Interior Ministry said.

The Egyptian military has banned journalists from entering northern Sinai, making it impossible to independently verify ­government-issued statements.

The attack came two weeks after Egyptian security forces killed 16 suspected militants in the same area and found weapons and explosives the Interior Ministry said were intended to be used in “terrorist attacks” in Arish.

The Islamic Statehas killed hundreds of Egyptian soldiers since the group’s affiliate, Wilayat Sinai, launched operations in ­November 2014. The insurgency in northern Sinai gained momentum and fresh recruits after army chief Abdel Fatah al-Sissi led a coup in 2013 that ousted the elected Islamist president, Mohamed Morsi. Sissi subsequently became president.

The militants have particularly targeted tourists and Coptic Christians, who make up roughly 10 percent of the country’s more than 94 million people. In 2015, the Islamic State affiliate asserted responsibility for downing a ­Russian passenger plane after it took off from the Red Sea resort town of Sharm el-Sheikh. That attack, which killed all 224 people aboard, shattered Egypt’s ­tourism-driven economy, which still has not fully recovered.

Last year’s military operation against the Islamist militants began less than three months after Islamic State fighters were widely believed to have killed more than 350 people at a mosque in northern Sinai.

Last week, Human Rights Watch alleged that Egypt’s security forces were carrying out ­extrajudicial killings, making arbitrary arrests and carrying out torture and other abuses against civilians in northern Sinai. In its report, the group said some of the abuses amounted to war crimes.

Egypt’s government publicly said the report was “full of lies.”