An Egyptian court has sentenced 40 people to life in prison over alleged ties to the Islamic State group and for helping recruit youth to join the extremists in Syria and Iraq.

The Criminal Court of Zagazig issued its verdict on Wednesday against the alleged militants, who were also convicted of plotting attacks against the police and Christians. Twenty of the suspects were sentenced in absentia.

Prosecutors say the group's alleged ringleaders were arrested at Cairo international airport on their way to Syria through Turkey, and later gave detailed confessions.

Rights groups have accused the Egyptian authorities of using torture and physical abuse to extract confessions.