CAIRO (Reuters) - An Egyptian court sentenced 37 people on Monday to jail terms including life imprisonment for joining or supporting Islamic State’s Sinai Province affiliate, judicial sources said.

Militants loyal to Islamic State have been waging an insurgency in the north of the Sinai Peninsula and other parts of the country that has killed hundreds of soldiers, police and residents.

A Cairo criminal court sentenced eight defendants to life terms and 29 to terms ranging from one to 15 years, after prosecutors accused them of planning attacks, promoting the group’s ideology in prisons and financing its cells, the judicial sources said. Seven were acquitted.

The defendants, all of whom pleaded not guilty, can appeal against the sentence at the court of cassation, Egypt’s top civilian court.

Separately, another Cairo criminal court referred the cases of three men accused over a 2018 failed assassination attempt against Alexandria’s security chief to Egypt’s top religious authority, paving the way for possible death sentences, judicial sources said.

Prosecutors said the defendants were part of a militant group called Hasm, which the government describes as an armed wing of the outlawed Muslim Brotherhood. The group denies any link with any militant activity.