The interior ministry said the two militants were "prominent leaders" of the Hasam group -- an extremist movement allegedly linked to the outlawed Muslim Brotherhood.
Egypt police trap and kill top militants
Egyptian police have killed two leaders of the Hasam militia in a shootout after intercepting them as they relocated to a new hideout on the outskirts of Cairo.
The interior ministry on Tuesday said the two militants were "prominent leaders" of the Hasam group -- an extremist movement the government accuses of having links to the outlawed Muslim Brotherhood.
The militia ambushed a police convoy and killed three officers in May. At the time, the group admitted carrying out the attack and the government has since blamed it on them too.
The authorities learned that some of the group's leaders were "about to move their equipment and weapons used in terrorist operations", the ministry said. After being tipped off that the new hideout was in a newly-constructed part of New Cairo, outside the city's main ring road, security forces set up checkpoints on roads leading to the area.
As a suspect car approached one of the checkpoints, its passengers opened fire on the police and the officers shot back, killing the two militants.
The two were identified as students aged 24 and 21 who were "among the most prominent leaders in the Hasam terrorist group," the ministry said.Police found seven automatic weapons, two other firearms, a large amount of ammunition, masks and radio communications equipment in the vehicle.
The militants who died were said to have been behind other attacks, including the May 2 ambush in which three policemen were killed and five wounded near the Cairo ring road. Hasam has previously claimed responsibility for deadly attacks against security forces as well as assassination attempts targeting a pro-government Muslim cleric and Egypt's deputy prosecutor general.
The ministry did not say when the shootout took place, only that the group were meant to be relocating on Tuesday.
The government says Hasam is linked to the Muslim Brotherhood movement of Egypt's former Islamist president Mohamed Morsi who was overthrown by the army in 2013.
On Twitter, the group claimed it had killed 27 people from "the military occupation militias," - a reference to Egypt's security forces - since it was formed a year ago.
Egypt is also fighting an insurgency by a local affiliate of ISIL which is based in North Sinai province. Hundreds of soldiers and police offices have been killed since Mr Morsi was ousted. President Abdel Fattah El Sisi has just extended the state of emergency he declared in April following bomb attacks on churches.