Egypt executed six men Sunday convicted by a military court over a gunfight last year at a suspected bomb factory, as explosives planted outside of courthouses wounded two people following the death sentence given to ousted Islamist President Mohammed Morsi.

The six executed men were convicted of killing two military officers in an hourlong battle with police, military and special forces during a raid north of Cairo in March 2014.

Judicial officials said the men also were convicted of belonging to the Sinai-based militant group Ansar Beit al-Maqdis, which has since pledged allegiance to the extremist Islamic State group.

Amnesty International had called for a retrial in a civilian court for the men, saying "at least three of the men were held in secret at the time of the crime they have been sentenced for."

Egypt has been struggling to contain violence by militants, but the scattered attacks have evolved into a full-fledged insurgency following Morsi's July 2013 ouster by the military. A court sentenced Morsi and over 100 others to death Saturday over a mass prison break during the 2011 uprising that ousted longtime autocrat Hosni Mubarak.

Just after Morsi's sentencing, suspected Islamic militants gunned down three judges Saturday in the Sinai Peninsula, officials said. On Sunday, the Islamic State group claimed responsibility for the attack in its daily English language audio bulletin, claiming it killed six judges. There was no immediate explanation for the discrepancy in numbers in the bulletin, which was posted by the SITE Intelligence Group, a U.S. firm that monitors jihadis.

Meanwhile, officials said a bomb exploded late Saturday outside the main courthouse in the southern city of Assiut, seriously wounding a police officer. Early Sunday, a bomb wounded a young girl near a courthouse in the Mediterranean city of Port Said, they said.

All officials spoke on condition of anonymity as they weren't authorized to speak to journalists.