France will take 150 of the 356 migrants on a humanitarian ship in the Mediterranean Sea as part of a deal reached with six European countries after a two-week standoff.
"Together, we managed to build a European solution,” tweeted French Interior Minister Christophe Castaner, adding that the 150 migrants would arrive in France "in the coming days".
The Norwegian-flagged Ocean Viking, run by charities MSF and SOS Mediterranee, has sought a port for almost two weeks after it rescued four boats of migrants off the coast of Libya between 9-12 August.
The 69-metre ship had been sailing between the Italian Island of Linosa and Malta, after Malta denied requests for a safe port and Italy ignored them.
SOS Mediteranee on Friday warned that the boat was running low on supplies.
No one will remain After talks with the European Commission, Malta agreed its navy would transfer the migrants, but they would not be allowed to stay.
The migrants will disembark in Malta, and then be relocated to France, Germany, Ireland, Luxembourg, Portugal and Romania. The EU's border and asylum agencies will help screen people before they are relocated.
"None will remain in Malta," tweeted Malta's Prime Minister Joseph Muscat.
About a hundred of the people on board the Ocean Viking are men under the age of 18. There are also four women and five young children. About two thirds of the people are from Sudan, with others from Cote d'Ivoire, Mali and Senegal.
Many were rescued from Libyan waters suffering from severe dehydration, and they say they fled Libya to escape ill treatment, arbitrary detention and sometimes torture.
Ad hoc is not a solution The Ocean Viking is the latest in a string of migrant ship standoffs, and charities have been highly critical of the lack of coordination and solidarity among EU member states in dealing with the problem.
Max Avis, search and rescue manager for SOS Mediterranee, said the current ad hoc approach to taking in migrants adds to their suffering, and he warned that the delay in taking in the rescued migrants has prevented the Ocean Viking from potentially rescuing others.
The charity said the ship would change crews and refuel before heading back to Libyan waters. Another rescue boat, Mare Jonio, set off for Libyan waters on Friday, according to the the Italian left-wing collective Mediterranea which runs the ship.