Spain's prime minister has said the country will take in a rescue ship stranded in the Mediterranean, to help avoid a humanitarian catastrophe.
Pedro Sánchez said he would give "safe harbour" to the Aquarius and the 629 people on board, after Italy and Malta both refused to let the ship dock.
The UN refugee agency and the EU had both called for a swift end to the stand-off between the two countries.
Mr Sánchez has said the ship will dock in Valencia.
The migrants aboard the Aquarius were picked up in six different rescue operations off Libya's coast, according to the German charity SOS Méditerranée.
Many are children, and pregnant women are also among them.
Italy's new Interior Minister Matteo Salvini refused to let it in, saying: "Saving lives is a duty, turning Italy into a huge refugee camp is not."
Mr Salvini, leader of the right-wing League party, promised during Italy's recent general election to take a tough stance against migration.
He said Malta should accept the Aquarius, but it refused, arguing that it falls under Italy's jurisdiction.
Italy is the main entry point for migrants crossing from North Africa to Europe.
SOS Méditerranée earlier said the Aquarius had been instructed by the Italian Maritime Rescue Co-ordination Centre to stand by in its current position, 35 nautical miles (65km) from Italy and 27 nautical miles from Malta.