Egyptian prosecutors have referred 28 terror suspects in two separate cases to court on charges of joining local affiliates of the Islamic State group and al-Qaida.

They said Monday the suspects were plotting attacks against security forces and the headquarters of the high state prosecution in Cairo.

They say only 17 of the 28 suspects are in custody. No date has been set for their trials. It was not clear when or where they were arrested.

An IS affiliate based in northern Sinai has carried out attacks across Egypt in recent years, mainly targeting security forces and the country's Christian minority.

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