The Aquarius migrant rescue boat which was turned away by Italy and Malta arrived at the Spanish port of Valencia this morning, ending a gruelling voyage which has made it a symbol of Europe's failure to agree on immigration.
Spain offered to help 629 mainly sub-Saharan Africans on board the Aquarius last week after Italy's new government, asserting its anti-immigrant credentials, refused to let it dock.
Spain's Prime Minister Pedro Sanchez, who took office two weeks ago, took the opportunity to show a more liberal stance.
But the plight of the Aquarius, run by Doctors Without Borders (MSF) with Franco-German charity SOS Mediterranee, highlighted the European Union's failure to agree on how to manage the huge influx of people fleeing poverty and conflict.
In Valencia, officials in white protective suits and masks greeted passenger as they left the ship and police started identifying them and processing their information.
The Aquarius arrived carrying 106 people rescued from unstable boats near Libya.
The others had been transferred to an Italian coast guard vessel and a ship belonging to the Italian navy to make the journey safer.
The coast guard boat was the first to arrive, docking in the eastern port with 274 on board just after dawn.
Shouts and singing erupted on the ship as people saw Valencia on the horizon.
A staff of 2,320, including volunteers, translators and health officials, were waiting on shore.
Red Cross Secretary General Elhadj As Sy was also in Valencia for the arrival.
"This sad odyssey of the people on the Aquarius is another reminder that all people, regardless of their nationality or immigration status, should have access to basic assistance and protection," he said in a statement.
"No human being is 'illegal', and people who need help should receive help."
Doctors Without Borders tweeted a photo of one of its team telling the people on board what they could expect.
"People are calm and pleased to be arriving in Spain," the group said.
All seven pregnant women on board the ships were taken for check-ups, and all the arrivals, including 123 minors, will receive psychological help.
Local government officials said none of the people who arrived on the first boat showed signs of serious illness, but many had suffered from crowded conditions and high temperatures in recent days.
UPDATE: #MSF team onboard #Aquarius explain to people rescued that they will disembark this morning in port of Valencia and what they can expect. People are calm and pleased to be arriving in #Spain. pic.twitter.com/ldnHgNwYTh— MSF Sea (@MSF_Sea) June 17, 2018
Anti-migrant feeling has surged in Italy, where more than 600,000 people have arrived by sea over the past five years, helping to propel the nationalist League into a coalition government.
Far fewer have come to Spain, but the numbers are rising fast.
Spain's coast guard rescued almost 1,000 people on Friday and yesterday.
A search is under way off the coast of Almeria, Spain, after four sub-Saharan men rescued by helicopter said their dinghy had been carrying a total 47 people when it sank.
Most Spaniards support the idea of welcoming and helping to integrate refugees, pollsters say.
That allowed Mr Sanchez, a socialist, to offer migrant-friendly policies to voters who felt previous governments did not do enough.
France, which criticised Italy for turning away the Aquarius, has offered to take in any passengers who qualify for asylum and want to go there.