ABIDJAN - A summit gathering European and African leaders from more than 80 countries drew to a close Thursday with plans for the immediate evacuation of some 3,800 African migrants stranded in Libya.

Wrapping up the summit in the Ivorian capital, a top African Union official said there could be as many as 700,000 Africans trapped in Libya, where many have suffered attrocities and even been sold into slavery.

The two-day summit of the African Union (AU) and European Union (EU) was showcased as a project to boost development in Africa as it faces a population crunch. But it was largely overshadowed by shock TV footage of black Africans sold as slaves in Libya, prompting protests in many countries and demands for action.

In a final address, AU commission chief Moussa Faki Mahamat said those stranded in Libya wanted to get out "as swiftly as possible," warning that there were between "400,000 and 700,000" people there and at least 42 migrant camps.

"We must urgently save those who are in this (dire) situation, and then together, Libya, the EU , AU and UN, we must think about devising longer-term solutions for the migration issue."

Hosting the summit , Ivorian President Alassan Outtara agreed there was an urgent need for action.

"The inhumane treatment of migrants challenges us, requiring responses which match our condemnation," he said. He called on humanitarian aid to go hand-in-hand with action to root out human trafficking, and solutions for the poverty that prompted so many young Africans to take the risk of trekking to Europe in search of a better life.

'Extreme emergency operation'

In a meeting late Wednesday, the leaders of Libya, France, Germany, Chad, Niger and four other countries agreed on a plan to allow migrants facing abuse in Libyan detention camps to be evacuated within days or weeks, mostly to their home countries.

They agreed on "an extreme emergency operation to evacuate from Libya those who want to be," French President Emmanuel Macron said.

"Libya restated its agreement to identify the camps where scenes of barbarism have been identified... President (Fayez) al-Sarraj, has given his agreement for ensuring access," Macron said, referring to the embattled head of the unity government in Libya. They also offered increased support for the International Organization of Migration (IOM) "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.

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 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.

Migration crisis

The uproar over slavery came after US network CNN aired footage from Libya of black Africans being sold.

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.

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 on Wednesday, 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 militant groups are spreading.

The summit was expected to issue a statement 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. Education for girls and long-term investment are key aspects of the plan.