Rwanda has agreed to take in hundreds of African migrants who are currently being held in Libyan detention centres.
A joint agreement between the government, the UN refugee agency (UNHRC) and the African Union (AU) was announced on Tuesday.
An initial group of 500 people will be evacuated by aeroplane to Rwanda in the coming weeks, a statement said.
That group, which includes children and vulnerable young people, is mainly made up of refugees from the Horn of Africa.
Thousands of migrants head to Libya each year to try and make the dangerous crossing over the Mediterranean Sea to reach Europe.
Those who fail are often held in detention centres. According to the UN, about 4,700 people urgently need to be moved to safety from these centres where conditions are said to be dire.
Why has Rwanda agreed to this?
Rwanda first made an offer to give refuge to the migrants in November 2017. It came after CNN released video that showed men in Libya being auctioned off as slaves.
Germaine Kamayirese, Rwanda's minister of refugee affairs, denied that the country was being paid to take in the migrants.
"It is just a humanitarian action," she told reporters in the capital, Kigali. "Any African should aim to do the same. I don't agree with those who are saying Rwanda has received any money from anyone".
Options for the migrants, many of whom come from Somalia, Eritrea and Sudan, would be worked out by the UNHCR once they arrived in Rwanda, the statement said.
"While some may benefit from resettlement to third countries, others will be helped to return to countries where asylum had previously been granted, or to return to their home countries if it is safe to do so," it said.
"Some may be given permission to remain in Rwanda subject to agreement by the competent authorities," it added.
Rwanda has previously denied striking a similar deal with Israel to take in African migrants who have been deported.
What's the background?
The policy of housing migrants within Africa is used by the European Union to stop migrants from arriving on its shores.
Camille Le Coz, from the Migration Policy Institute, told the BBC that a deal exists between the EU and Niger, where migrants are often held as they wait to be granted passage to Europe.
Inside a Libyan migrant detention camp
In July, the UN called for the dismantling of all detention centres for refugees in Libya. It said the facilities were not fit to house migrants.
Detainees in various centres have described routine torture, rape, malnutrition and the spread of diseases like tuberculosis due to the conditions they are forced to endure.
Campaign group Amnesty International has called conditions "horrific" and "inhuman".
Last month, Libya announced plans to shut down three of its biggest migration detention centres in in Misrata, Tajoura and Khoms.
Organisations that monitor the situation in the country fear these closures may lead to even more overcrowding in the remaining centres.