ROME (AP) — Spain's new prime minister has ordered authorities to allow a rescue ship carrying 629 migrants to dock in the eastern port of Valenica after the boat was refused by Italy and Malta.

A statement sent Monday by Prime Minister Pedro Sanchez's office says "it is our duty to avoid a humanitarian catastrophe and offer a secure port for these people."

Amid the political dispute, The Aquarius, a rescue ship belonging to the SOS Mediterraneee charity, has been stuck in the Mediterranean Sea with its passengers, including 123 unaccompanied minors and seven pregnant women. Medical workers say food onboard the ship is going to run out Monday night.

The government statement said Spain wanted to comply with its international responsibilities on humanitarian crises.

Medical workers on the ship, which has unaccompanied minors and pregnant women on board, say it will run out of food by the end of Monday.

Marco Bertotto of Doctors Without Borders also told Italian state TV on Monday that some of the migrants aboard the Aquarius have water in lungs after falling into the Mediterranean Sea from smugglers' boats.

Others have burns from boat fuel mixed with seawater or are suffering from hypothermia.

The aid group SOS Mediterranee's ship plucked 229 migrants from the sea or from flimsy dinghies in the Mediterranean on Saturday. The ship also took aboard 400 others who rescued elsewhere by the Italian navy and coast guard or by cargo ships.