CAIRO: A raid by Egyptian police, military and special forces on a suspected bomb factory outside of Cairo turned into an hours-long gun battle with insurgents who detonated car bombs in clashes that killed two military officers and five militants, the Interior Ministry said Wednesday.

The ministry, which is in charge of police, said an investigation showed that Al-Qaeda-inspired militant group Ansar Beit Al-Maqdis, or Champions of Jerusalem, used the timber workshop in Arab Sharkas village in Qalioubiya province to build and store bombs.

During the raid early Wednesday, militants opened fire on security forces and set off the car bombs, sparking a gun battle that lasted several hours, the ministry said.

The fighting killed a brigadier general and a colonel, both explosive experts, military spokesman Col. Ahmed Mohammed Ali said in a post on his Facebook page.