A rescue boat filled with hundreds of refugees has been stranded in the Mediterranean sea after no country or port was willing to accept it.

Now the Spanish prime minister, Pedro Sanchez, who took office just over a week ago, has said Spain will be allowing the rescue vessel to dock in the city of Valencia, where the rescued migrants and refugees can finally disembark.

Refugees on the boat, which rescued more than 600 people in six separate operations, waited for four hours to hear if they would be allowed to dock in an Italian port, after a political discord in the country prevented the rescued people from disembarking there.

Leoluca Orlando, the mayor of Sicilian city Palermo, previously said he would defy government orders and allow the ship to dock in the city’s port. It is unclear if the Italian coastguard would have cooperated with his orders, however.

Other Italian cities and towns, including Naples, Messina and Reggio Calabria, have also pledged to take in refugees in protest of the country’s new hardline stance on immigration due to the new populist government.

French humanitarian group SOS Mediterranée said 629 migrants have been taken on board the Aquarius rescue boat, including 123 unaccompanied minors and seven pregnant women.

Matteo Salvini, Italy’s interior minister and leader of far-right party Lega Nord (Northern League), said on Sunday that all Italian ports were closed to the Aquarius, and called on Malta to take in the vessel.

In a Facebook post he wrote: “Malta takes in nobody. France pushes people back at the border, Spain defends its frontier with weapons. From today, Italy will also start to say no to human trafficking, no to the business of illegal immigration.”

In response to the new laws, Mr Orlando said: “Palermo in ancient Greek meant ‘complete port’. We have always welcomed rescue boats and vessels who saved lives at sea.

Refugees and migrants arriving in Catania, Sicily Show all 7 1 /7 Refugees and migrants arriving in Catania, Sicily Refugees and migrants arriving in Catania, Sicily Refugees and migrants arriving in Italy on MSF rescue ship the Bourbon Argos in Catania, Sicily Lizzie DeardenÍ Refugees and migrants arriving in Catania, Sicily Refugees and migrants disembarking from MSF rescue ship the Bourbon Argos in Catania, Sicily Lizzie Dearden Refugees and migrants arriving in Catania, Sicily Refugees and migrants undergoing health checks after disembarking from MSF rescue ship the Bourbon Argos in Catania, Sicily Lizzie Dearden Refugees and migrants arriving in Catania, Sicily Refugees and migrants undergoing security checks after disembarking from MSF rescue ship the Bourbon Argos in Catania, Sicily Lizzie Dearden Refugees and migrants arriving in Catania, Sicily Refugees and migrants being fingerprinted after disembarking from MSF rescue ship the Bourbon Argos in Catania, Sicily Lizzie Dearden Refugees and migrants arriving in Catania, Sicily Refugees and migrants being fingerprinted after disembarking from MSF rescue ship the Bourbon Argos in Catania, Sicily Lizzie Dearden Refugees and migrants arriving in Catania, Sicily A man being taken to hospital from MSF rescue ship the Bourbon Argos in Catania, Sicily Lizzie Dearden

“We will not stop now. Salvini is violating the international law. He has once again shown that we are under an extreme far-right government.’’

The Aquarius patrols the sea route between Libya and Italy. According to the UN there have been more than 30,000 sea arrivals of refugees in the Mediterranean so far this year.

This number has been decreasing dramatically in recent years. In October 2015 alone there were 221,454 sea arrivals in the area.

A spokesperson from MSF, or Medecins Sans Frontieres (Doctors Without Borders), said in a statement: ”MSF is concerned that again politics are being placed above people’s lives. The priority must be the importance of the well being and safety of the people on board.”

UNHCR’s special envoy for the central Mediterranean, Vincent Cochetel, said in a statement: “There is an urgent humanitarian imperative here. People are in distress, are running out of provisions and need help quickly.

“Broader issues such as who has responsibility and how these responsibilities can best be shared between states should be looked at later.”

The European Commission has also urged action to be taken to help the refugees on the Aquarius.

Commission spokesman Margaritis Schinas told a news conference: “The priority of both the Italian and Maltese authorities should be ensuring these people receive the care they need.

“We call on all involved to contribute to a swift resolution so that the people on board the Aquarius vessel may be safely disembarked as soon as possible.”

EU law stipulates that asylum seekers register in the first safe country they reach, however countries such as Italy and Malta, which are typically among the first states reached by people fleeing their native lands, say this responsibility needs to be shared across the bloc.

Migrants and refugees trying to cross the Mediterranean have often found themselves caught up in political and legal disputes.

In September 2017, a German charity challenged the seizure of one of their rescue ships after Italian authorities claimed to have evidence that the vessel had been in contact with smugglers.