Images of slave auctions in Libya sparked protests in many countries, including this rally outside the Libyan embassy in Morocco

Libya agreed Wednesday with key EU and African leaders to allow migrants facing abuse in detention camps to be evacuated within days or weeks, mostly to their home countries, French President Emmanuel Macron said.

The decision was taken after Ivory Coast President Alassane Ouattara called for "all urgent measures" to end slave trading and other migrant abuses in Libya at an EU-Africa summit in Abidjan.

The leaders of Libya, France, Germany, Chad, Niger and four other countries "decided on an extreme emergency operation to evacuate from Libya those who want to be," Macron told reporters after their emergency talks on the summit sidelines.

The summit comes just two weeks after US network CNN aired footage of black Africans sold as slaves in Libya, sparking outrage from political leaders and street protests in African and European capitals.

"Libya restated its agreement to identify the camps where barbaric scenes have been identified," Macron said, adding Libya's UN-backed Prime Minister Fayez "Sarraj gave his agreement that access be assured".

African Union, European Union and United Nations officials at the meeting offered increased support for the International Organisation of Migration "to help with the return of the Africans who want it to their home countries," said the French leader who called the emergency meeting.

"This work will be carried out in the next few days, in line with the countries of origin," he said, adding in some cases they could be given asylum in Europe.

- 'Wretched drama' -

EU sources earlier said UN humanitarian agencies like the IOM had arranged for some 13,000 migrants to return voluntarily to their home countries mainly in sub-Saharan Africa in the last year after a deal with Libya.

The furore over slavery as well as torture and rape of black African migrants in Libya prompted the select group of countries -- which also included Spain, Italy, Morocco and the Congo -- to undertake other measures.

The group also decided to work with a task force, involving the sharing of police and intelligence services, to "dismantle the networks and their financing and detain traffickers," Macron said.

The AU, EU and UN officials also pledged to freeze the assets of identified traffickers while the AU will set up an investigative panel and the UN could take cases before the International Court of Justice, he added.

Opening a European Union-Africa summit that was meant to focus on the continent's long-term economic development, Ouattara immediately lashed out at slavery as a "wretched drama which recalls the worst hours of human history."

Other African, EU and United Nations leaders also condemned the slavery revelations when they met at the summit in Ivory Coast's economic capital Abidjan.

"I would like to appeal to our sense of responsibility to take all urgent measures to put an end to that practice, which belongs to another age," he said, opening the gathering of 55 African Union and 28 EU leaders.

African Union and other critics have accused the EU of creating conditions for the slave trade as well as rape and torture of migrants by encouraging Libya's UN-backed Government of National Accord (GNA) to detain migrants and stop them from coming to Europe.

- Root causes -

The EU has been desperate to ease the worst migration crisis since World War II, with more than 1.5 million migrants entering the bloc since 2015.

In his speech to the summit, European Council President Donald Tusk acknowledged the "horrifying" treatment of young Africans.

But he also warned against starting "a blame game" and called for cooperation to fight criminals.

An EU source told reporters on condition of anonymity that it was European pressure that forced Libya to open up and make it easier for journalists to film slave auctions that migrants had in fact reported were going on well before EU-Libyan cooperation began.

EU officials said the migrant influx, which has deepened political divisions across the EU, as well as frequent Islamist attacks in Europe have been a wake-up call to tackle the root causes of why people leave their homes.

The EU has already set up multi-billion-euro funds to promote Africa's economic development while deepening counter-terrorism cooperation with African countries where Islamist militant groups are spreading.

The summit, due to wind up on Thursday, is intended to focus on providing stability and long-term economic growth for a continent likely to have 2.4 billion people by 2050, more than double what it is now.

Without fast-tracked development, millions could flee to Europe or turn to radical Islamist groups, EU and African leaders say.