VALLETTA — Nearly 50 migrants stranded at sea for weeks aboard two rescue ships were headed for Malta on Wednesday after the island nation reached a deal with other EU member states, ending a standoff that rights groups branded ‘‘shameful’’.
‘‘An ad hoc agreement has been reached,’’ Malta Prime Minister Joseph Muscat told journalists, adding that the deal also included a decision on the fate of 249 rescued migrants already on the island.
The 49 migrants, including a baby and several children, were rescued by two boats on December 22 and 29 while attempting the dangerous Mediterranean crossing from North Africa to Europe.
But with no country allowing them to dock, they were left stranded off the coast of Malta, suffering sea sickness and dehydration, with some briefly refusing food and an onboard doctor warning of psychological stress.
There were ecstatic cheers on board the Sea-Watch 3 when a crew member told them ‘‘we have a safe port, it’s over’’, according to a video Tweeted by the German NGO Sea Watch International.
The migrants were expected to arrive in Malta later Wednesday after being transferred from the Sea-Watch 3 and Dutch-flagged Albrecht Penck ships to Maltese coastguard vessels.
Muscat said that of the total of 298 migrants, 176 would be sent to Germany, France, Portugal, Ireland, Romania, Luxembourg, The Netherlands and Italy.
Another 78 will be allowed to stay in Malta, and 44 Bangladeshi migrants will be sent back to their country.
‘Not Europe’s finest hour’
Those pulled to safety by the two rescue ships had been unable to disembark because of a diplomatic deadlock among EU member states, despite an appeal by Pope Francis on Sunday.
‘‘The past weeks have not been Europe’s finest hour… If human values and solidarity are not upheld, then it is not Europe,’’ said EU Migration Commissioner Dimitris Avramopoulos.
Amnesty International’s Southern Europe researcher Elisa De Pieri said the time taken to reach a decision on the migrants’ fate was ‘‘shameful’’.
‘‘The dangerous, unseemly spectacle of politicians bickering whilst women, men and children are stranded in a sea of cruel indifference, must not be repeated,’’ she said.
‘‘The Italian and Maltese authorities have brazenly undermined the search and rescue system and used people as pawns to negotiate migration policies.’’
Muscat, who has previously complained that his country has to bear an unfair share of migrant numbers, insisted Malta had ‘‘never closed its ports and it is still a safe port’’.
‘‘We wanted to send a strong political message that the burden must be shared because it is a European issue… Every hour that passed without a solution was not an hour I was proud of,’’ he said.
‘Confession of state failure’
Sea Watch International welcomed that ‘‘the EU decided to release their 49 hostages. After 19 days at sea, our guests will finally reach a safe port’’.
‘‘This represents a confession of state failure, policy must not be made at the expense of people in distress,’’ the NGO said.
‘‘We want to express our gratitude to… all cities, federal states and provinces that declared their ports open and their willingness to welcome people.’’
But Muscat issued a warning to future rescuers: ‘‘I reiterate, as I did before, that this case shall not act as a precedent.’’
Migrants rescued by ships have frequently been left in limbo since Italy’s populist anti-immigration government began turning them away last summer.
Since coming to power more than six months ago, the Italian government has also been demanding greater solidarity from reluctant fellow EU states.
But EU members have failed to agree on a permanent mechanism to relocate migrants who reach Europe’s shores, even though arrivals have dropped sharply since a peak more than three years ago.
Following Wednesday’s deal, Italy’s far-right Interior Minister Matteo Salvini accused the European Commission of ‘‘facilitating the work of smugglers and NGOs’’.
‘‘I am and will remain absolutely against new arrivals in Italy… Giving in to the pressures and threats of Europe and NGOs is a sign of weakness.’’
Some 113,482 migrants crossed the Mediterranean to reach Europe last year, according to the UN refugee agency, which said 2,262 people lost their lives or went missing making the perilous journey.