Gunmen shot dead an Egyptian officer in charge of the Islamist Muslim Brotherhood file at the interior ministry's national security agency, the ministry said on Monday.
The officer was gunned down while in his car outside his home late on Sunday, it said.
Security officials named the dead man as Mohamed Mabruk and said his work had focused on Islamist groups that have escalated their attacks since the July 3 overthrow of president Mohamed Morsi.
One security official said Mabruk had been involved in drafting the charges against Morsi and Brotherhood chief Mohammed Badie that led to trials for both of them.
Mabruk had been due to testify this week against the Islamist Morsi who is accused of working with groups such as Palestinian Hamas and Lebanese Hezbollah to escape from prison during the popular 2011 uprising that toppled Hosni Mubarak.
Police said Mabruk was hit by seven bullets fired by three gunmen in the Cairo neighbourhood of Nasr City.
A security official said the attack rattled the interior ministry and that it "will be investigated at the highest levels".
In a statement, prime minister Hazem al-Belawi condemned Mabruk's "assassination by treacherous hands".
"The government will not tolerate criminal and terrorist groups who raise their arms to terrorise security officials," Beblawi said.
He said the authorities are "able to cleanse the country of all criminal hands, returning security and safety to all corners of Egypt".
No one has yet admitted responsiblity for Sunday's attack.
Al-Qaeda-inspired groups have claimed previous attacks in the capital, including a September bombing that targeted interior minister Mohammed Ibrahim's convoy.
He survived the bombing.
The attack on Ibrahim was seen as a precedent by Sinai militant groups that had previously limited their operations to the restive peninsula.
Unrest has spiked in Egypt since the military overthrew Morsi more than four months ago.
A subsequent crackdown against supporters of the Islamist leader and his Muslim Brotherhood has left more than 1,000 people dead and upwards of 2,000 behind bars.
The army has also sent tanks and aircraft to north Sinai to battle Islamist militants who have killed more than 100 police and soldiers since Morsi's overthrow.