Prosecutors referred 40 people to criminal court on Sunday after an investigation revealed that they communicated with Islamic State (Daesh) fighters in Iraq and Syria, judicial sources said.

The head of the south Sharqiya prosecution, Belal Abu Khadra told Aswat Masriya that an investigation has "proven communication" between those referred to trial and the militant group.

He said half of the defendants are in custody, while the other 20 are at large.

Meanwhile, the prosecution's representative in Zagazig, the capital of the Nile Delta province of Sharqiya, said that according to the investigation, the 40 referred to court have received military training in Syria in order to carry out "terrorist operations" inside Egypt.

He added that they adopted the extremist thought, in which non-followers of this thought are often considered apostates.

The defendants face charges of joining an armed group that resorts to violence and was established in violation of the law, planning to carry out "terrorist operations" inside the country and destabilising national security.

Egypt's prosecution launched an "extensive investigation" on Islamic State fighters in Iraq and Syria and the "crimes" the group "commits against Egyptians," in February.

This was days after Egypt struck militant targets in Libya against Islamic State fighters, in response to the beheading of 20 Egyptians at the hands of men believed to belong to a Libyan division of Islamic State fighters.

The investigation includes looking into the involvement of Egyptian fighters in the militant group, a statement from the prosecution's office said at the time.

According to the International Centre for the Study of Radicalisation and Political Violence, as of January 2015, the number of foreign fighters in Iraq and Syria exceeds 20,000, with the Middle East supplying 11,000 of them. Egypt is the source of 360 of those fighters, the report said.