The Aquarius is a 77-metre (250 foot) rescue boat which has the capacity for carrying between 200 and 500 people
MALTA - 15 August 2018: Five European countries on Tuesday offered to take in the 141 migrants marooned on board the Aquarius rescue vessel after it was given permission to dock in Malta, resolving a new standoff over the charity ship.
Spain offered to take 60 people and Germany said it would take "up to 50".
France said it would accept 60 from the Aquarius as well as a second rescue boat that arrived earlier in Malta, and Portugal offered to welcome 30 people. Luxembourg was also part of the deal.
The agreement is the fifth of its kind between Western European governments since June when Italy began turning away migrant rescue ships.
EU sources said the five host countries would send immigration officials to Malta to vet their asylum claims and identify possible economic migrants, who would be returned to their countries of origin.
The boat was initially refused entry by Italy and Malta after rescuing the migrants in two separate missions off the Libyan coast on Friday.
The Aquarius first hit the headlines in June after being stranded with 630 migrants on board, causing a major diplomatic row.
Spain's new Socialist government helped resolve the first standoff by allowing the boat to dock in Valencia and said it was again at the forefront of the solution to the latest one on Tuesday.
"Spain has coordinated a pioneering agreement with six countries to share the hosting of the people on the Aquarius... Spain will take 60 people," Prime Minister Pedro Sanchez wrote on Twitter.
But Malta and France said the deal to allow the ship disembark its passengers, many of them unaccompanied teens from violence-wracked Somalia and repressive Eritrea, was their initiative.
"Malta will be making a concession allowing the vessel to enter its ports, despite having no legal obligation to do so," said a Maltese government statement posted on Twitter.
Thanking Malta for its gesture, French President Emmanuel Macron wrote on Twitter: "There is no alternative to cooperation."
But EU migration commissioner Dimitris Avramopoulos warned that Europe could not rely on "ad-hoc arrangements".
Calling in a statement for "sustainable solutions", he said: "It is not the responsibility of one or a few member states only, but of the European Union as a whole."
- European attitudes hardening -
After elections in March that brought a populist, anti-immigrant government to power in Italy, far-right Interior Minister Matteo Salvini began turning away rescue ships operated by foreign NGOs.
For years, Italy had pleaded with its EU partners for help with a massive influx of arrivals that has seen 700,000 people land in the country since 2013, most of whom had made the short but treacherous sea crossing from Libya.
On Saturday, Salvini said the Aquarius would "never see an Italian port" again, accusing it of encouraging smugglers and migrants to take to the water in the knowledge that they will be rescued.
The Italian coast guard continues to rescue migrants, however.
Malta's government initially defended its decision to turn the Aquarius away, saying it was "neither the coordinating nor the competent authority for such a rescue" and had "no legal obligation" to provide a place of safety.
The government of the British territory of Gibraltar also announced late Monday that the ship would no longer be allowed to operate under its maritime flag.
The increasingly hostile stance reflects hardening public opinion in Europe towards migrants -- despite arrivals dipping sharply since 2015, when over a million people fleeing war or poverty crossed the Mediterranean.
The Aquarius has become a symbol of the unwillingness of many European countries to accept more newcomers, with Italy siding with conservative governments in eastern Europe intent on keeping out migrants.
At a summit in late June EU leaders agreed to consider setting up migrant processing centres outside the bloc, most likely in North Africa, in a bid to discourage them from boarding smuggler boats.
They also agreed to look at setting up "controlled centres" on European soil to sort refugees in need of protection from economic migrants -- but no country has offered to host any such centres.
The proposals are due for discussion at an EU migration summit in Austria in September.