An Egyptian court has sentenced 18 suspected militants to life in prison for allegedly forming a "terrorist cell" affiliated with the Islamic State group.

The Cairo criminal court on Saturday sentenced another 12 defendants to 10 to 15 years on charges that include plotting attacks on the country's Christian minority in the Mediterranean city of Alexandria, assaulting security forces and disrupting public order.

All sentences are subject to appeal.

Egypt has been battling Islamic militants for years, but the insurgency gained strength after the 2013 military overthrow of a freely elected but divisive Islamist president.

Since then, courts have held mass trials and sentenced hundreds of people to death.

Rights groups have repeatedly criticized such mass sentencings in Egypt and called on authorities to ensure fair trials.