Militants opened fire on a microbus filled with plainclothes police in a Cairo suburb early Sunday, killing eight of them, including an officer, in an attack claimed by a local ISIS affiliate.

The attack was the deadliest in the heavily policed capital since November, when gunmen attacked a security checkpoint, killing four policemen. That attack was also claimed by the local ISIS affiliate.

Egypt's state-run MENA news agency said the policemen were inspecting security in the south Cairo suburb of Helwan early Sunday when four gunmen in a pickup opened fire on them.

Interior Minister Magdy Abdel-Ghaffar, in charge of police, ordered an investigation into the attack.

"These are the heroes whose blood mixes with the nation's soil every day," Abdel-Ghaffar told state television at the end of a brief military funeral for the eight policemen.

"We are determined to continue our march against terror and anyone who seeks to undermine the nation's stability," he said, as black-clad female relatives of the policemen wailed in grief.

The coffins of the eight, wrapped in the Egyptian flag, were placed atop red fire engines that led a procession of several hundred mourners, including other policemen.

An ISIS affiliate claimed responsibility for the attack in an online statement, saying it killed everyone in the vehicle. It identified the officer and said the fighters seized light weapons from the police before they fleeing the scene unharmed.

It said the operation was to avenge women jailed in Egypt. The claim could not be independently verified, but the statement's language and the nature of the attack suggest it is authentic.

Militants have been targeting security forces in the Sinai Peninsula for years, but their attacks have grown more deadly and frequent since the 2013 military overthrow of Islamist President Mohammed Morsi. An ISIS affiliate based in the Sinai is now spearheading the insurgency.

While most of the unrest has been confined to the northern Sinai, there have been attacks in the mainland as well, mainly small-scale bombings targeting police, the frequency of which had declined in recent months.

Sunday's attack came as the interior minister was locked in a dispute with the Egyptian Journalists Syndicate following the arrest last week of two reporters who had taken refuge inside the syndicate's building in downtown Cairo. The syndicate's board says the ministry did not give it advance warning and has demanded that Abdel-Ghaffar be fired.

Several newspapers have protested by not mentioning the minister by name and by only publishing altered photos of him designed to look like negatives. It was not yet clear how they would cover his response to Sunday's attack.

Rights groups have accused Egypt's police of widespread abuses, including the torture of dissidents, with some likening their tactics to those used during the rule of President Hosni Mubarak, who was overthrown in a 2011 uprising.

The Interior Ministry has denied any systematic abuses, and is likely to point to attacks like the one carried out on Sunday to argue that it is defending the country against Islamic militants who have sown chaos across the region.