Algerian foreign minister Abdelkader Messahel said that North Africa is under threat from foreign fighters fleeing ISIL's defeats in Iraq and Syria.

Mr Messahel spoke at a news conference in Cairo after meeting his Egyptian and Tunisian counterparts, Sameh Shoukry and Khemaies Jhinaoui, to discuss Libya.

ISIL took advantage of the chaos of Syria's conflict, which broke out in 2011 with protests against president Bashar Al Assad.

After its rapid rise in 2014 and conquest of vast swaths of territory in Syria and Iraq, ISIL established what it called a "caliphate" that attracted thousands of foreign fighters.

A string of losses this year have left the extremists clinging on to pockets of territory in Iraq and Syria.

"The region is threatened... with the return of foreign fighters," said Mr Messahel. "The signs and reports say the return will be in our region."

The ministers also met to discuss Libya in February in Tunisia and again in June in Algeria, as the three countries push for a solution in Libya.

The priority is "preserving Libya's unity and stability and territorial integrity, and maintaining dialogue and Libyan political agreement as the sole basis for settling the Libyan crisis", Egypt's foreign ministry said .

Libya has been rocked by chaos since the 2011 fall and murder of longtime dictator Muammar Qaddafi, with rival administrations and militias vying for power.

Extremists, arms dealers and people traffickers have since taken advantage of the chaos to gain a foothold in the oil-rich North African country.

"What is happening in Libya threatens its security and stability and it has become a refuge for a number of terrorist groups," Mr Jhinaoui said.