More than 6,000 Africans who fought for the Islamic State group in Iraq and Syria could return home, the African Union's top security official warned on Sunday, calling on countries to prepare for the threat.

Tens of thousands of foreign fighters joined the extremist group after it seized vast swathes of Iraq and Syria and declared a caliphate in 2014.

In the last year, the group has suffered a host of losses to both its territory and military capabilities.

The huge losses suffered by IS have sparked fears that foreign fighters may now relocate, bringing a threat of violence with them.

"There are reports of 6,000 African fighters among the 30,000 foreign elements who joined this terrorist group in the Middle East," Smail Chergui, the AU's commissioner for peace and security, said.

African nations would need to work closely with each other and share intelligence to counter returning militants, he said in a meeting in Algiers, according to the Algeria Press Service news agency.

"The return of these elements to Africa poses a serious threat to our national security and stability and requires specific treatment and intense cooperation between African countries."

Iraqi Prime Minister Haider al-Abadi on Saturday declared victory in a three-year war by Iraqi forces to defeat the Islamic State group, which at its height endangered Iraq's very existence as a country.

In Syria, IS have faced separate onslaughts by forces backed by Russia and the US in Deir az-Zour province and now control just a tiny sliver of the region along the Euphrates river.

The defeat of IS is a massive turnaround for an organisation that in 2014 ruled over 7 million people in a territory as large as Italy encompassing large parts of Syria and nearly a third of Iraq.