Four gunmen shot dead eight policemen on Sunday in a Cairo suburb, the latest in a series of assaults targeting security forces in Egypt.
The plainclothes officers were inside a small bus in the southern suburb of Helwan when the gunmen in a pickup truck, opened fire and then fled, the Interior Ministry said in a statement.
The four assailants used automatic rifles, the ministry said.
Pictures in Egyptian media showed the police bus riddled with bullets and stained with blood.
There were conflicting claims of responsibility for the attack, which is by far the deadliest assault carried out by suspected Islamist militants in the Egyptian capital.
A local group loyal to the Islamic State extremist militia said it was behind the killings.
In an online statement circulated by its supporters, the group Islamic State in Egypt alleged the attack had been mounted by its members and that the gunmen seized weapons from the slain officers before fleeing the scene unharmed.
The group said that the assault was in "revenge" for female prisoners in Egypt.
The statement could not be independently verified.
Islamic State has claimed responsibility for several attacks on Egyptian security forces in the past two years.
Another group, calling itself Popular Resistance, said on Facebook that it carried out the attack to commemorate the 1,000th day after a deadly security crackdown on a Cairo protest camp by backers of ousted president Mohammed Morsi of the Muslim Brotherhood.
Local media said that the Popular Resistance is a militant group linked to the now-banned Muslim Brotherhood.
Analyst Mokhtar Awad of George Washington University in the United States wrote on Twitter that the Islamic State claim was the most credible, adding "Popular Resistance Movement are trolls."
Also on Sunday, Prosecutor General Nabil Sadeq formally referred 67 defendants to trial over the assassination last year of his predecessor Hisham Barakat in a Cairo car bomb attack.
Sadeq alleged that the 67 were members of the Muslim Brotherhood and had conspired with Palestinian Islamist movement Hamas, which controls the Gaza Strip, to kill Barakat.
Both Hamas and the Brotherhood have previously denied any involvement in the killing.
Barakat was the most senior figure to fall victim to a spate of attacks by Islamist militants since the army's 2013 overthrow of Morsi - Egypt's first democratically elected president - following massive protests against his one-year rule.
In June Morsi and three other Brotherhood leaders were sentenced to death on charges of conspiring with Hamas and the Lebanese Shiite movement Hezbollah to storm prisons where they and Hezbollah and Hamas members were held during the 2011 revolution that ousted dictator Hosny Mubarak.
The Brotherhood condemned that verdict - which remains subject to appeal - as "another nail in the coffin of democracy in Egypt." Amnesty International said that the trial was "grossly unfair."