BRUSSELS/MADRID (Reuters) - Five EU states agreed to take in scores of migrants stranded for weeks on board a crowded rescue ship, EU authorities said on Wednesday, ending a prolonged standoff with Rome over their fate.

The around one hundred mostly African migrants, picked up in the Mediterranean from early August onwards by the Open Arms, had been forced to remain on the Spanish-registered vessel after the Italian government refused to allow it to dock in line with a closed ports policy it adopted last year.

They finally disembarked on the Sicilian island of Lampedusa on Tuesday night after an Italian prosecutor ordered the ship’s seizure and evacuation. Several of the migrants jumped overboard and tried to swim to shore.

Spain, France, Germany, Luxembourg and Portugal had agreed to take all of them in, said a European Commission spokeswoman in Brussels. Authorities in Madrid and Lisbon confirmed their readiness to participate.

STEADY FLOW OF REFUGEES

A succession of charity vessels has struggled over the past year to bring migrants rescued at sea to Italian shores. The country’s far-right Interior Minister Matteo Salvini has taken a tough line on migrant entry since the coalition government he forms part of took office in June 2018.

With the continuous flow of refugees desperate to cross from Africa to Europe, the Commission said it was seeking recipient states for the migrants on board a second charity ship, the Norwegian-flagged Ocean Viking, whose disembarkation Salvini had also sought to prevent. The ship is carrying 356 migrants.

Slideshow ( 3 images )

Refinitiv data pinpointed that vessel west of the Maltese island of Gozo.

Salvini, who has clashed with Italy’s court system over his attempts to veto landings, says the country has borne too much responsibility for handling migration to Europe. This month the coalition his League party formed with the 5-Star movement collapsed.

Signs of the impact of the migration crisis were also evident in Madrid, where the government said the Open Arms was not authorised to carry out rescues, only to provide humanitarian aid. The charity had previously been threatened with a fine if it continued to perform rescues.

Asked if the government would sanction Open Arms, Spain’s acting deputy prime minister Carmen Calvo declined to answer directly, telling Cadena Ser radio that no one was above the law, “including a ship like this.”

European Commission spokeswoman Tove Ernst said the five countries receiving the Open Arms migrants would register them and make necessary checks and transport arrangements, meaning the relocation from Lampedusa would take some time.

“The Commission will ...do its utmost to support and help to ensure that procedures are as swift as possible,” she said.

EU states have been at loggerheads over migration since a spike in Mediterranean arrivals in 2015, with bitter feuds over how to handle refugees and migrants damaging the bloc’s unity. EU leaders are due to discuss the issue again when they meet in Brussels mid-October.