Five policemen, including three officers, were also injured in the shootout, he said.
Police raided two apartments in Ard Ellewa district on a tip-off that terrorists were hiding there and preparing to launch attacks, the state-run MENA news agency reported.
When the police forces approached to the apartment, terrorists opened fire on them, the official said.
Nine terrorists were killed in the exchange of gunfire, he said.
A huge cache of arms and ammunition was also recovered by the police.
Hundreds of police and army personnel have been killed since then.