CAIRO (Reuters) - Gunmen killed eight plainclothes police on the southern outskirts of Cairo overnight, the Egyptian interior ministry said, in an assault claimed by Islamic State militants.

The four attackers pulled alongside in a pick-up truck and sprayed a police vehicle with automatic weapons fire before fleeing, the ministry said on Sunday.

The gunmen wore masks, residents in Helwan, an industrial area on the edge of the capital, told Reuters.

Egypt’s government is facing an insurgency that has killed hundreds of soldiers and policemen, mostly in northern Sinai, since mid-2013, when then-army chief Abdel Fattah al-Sisi ousted Islamist President Mohamed Mursi following mass protests.

Islamic State’s Egyptian affiliate, which calls itself Sinai Province, mainly operates out of the northern Sinai Peninsula, which borders Israel, the Gaza Strip and the Suez Canal.

Militants have also occasionally targeted security forces and planted bombs in Cairo and other areas.

In an Arabic-language statement, Islamic State said the Helwan attack was part of its Abi Ali Al-Anbari campaign, which has seen the group carry out a series of bombings and other attacks in Iraq.

It was not clear how or why Egypt was linked to the Iraqi campaign. The statement also said the attack was aimed at avenging women held in Egyptian jails, but gave no details.

Islamic State controls swathes of Iraq and Syria. In 2014, an Egyptian militant group called Ansar Bayt al-Maqdis pledged allegiance to Islamic State and changed its name to Sinai Province.

Al Azhar, a historic center of Islamic learning in Cairo, condemned what it called a “terrorist attack the likes of which contradict Islamic teachings” and offered in a statement its support for Egypt’s security forces.