After a nerve-wracking stand-off and intense negotiations, 629 people rescued in the Mediterranean Sea by the Aquarius, a rescue ship run by two nongovernmental groups, SOS MEDITERRANEE and MSF, are finally heading towards Spain. Spain’s humane gesture stands in stark contrast to the disgraceful behavior by Italy and Malta.

The saga began on Monday when Italy refused to let the Aquarius dock and disembark passengers in Italy, insisting Malta should do so. Malta refused, insisting Italy had responsibility. Finally, the new Spanish Prime Minister Pedro Sanchez stepped up to offer safe harbor in Valencia.

Italian Interior Minister Matteo Salvini, architect of this drama, crowed that “It pays off to raise one’s voice politely.” Stranding hundreds of people at sea is hardly polite.

It’s true that Italy has shouldered an out-sized responsibility for saving lives at sea – including in waters well outside its designated search-and-rescue area – and for processing and accommodating disembarked migrants and asylum seekers. But closing Italy’s ports is an unconscionable way to pressure other European Union states to do more.

Malta, a tiny island nation with a vast search-and-rescue area, already hosts a high per capita number of asylum seekers and refugees. But this cannot excuse its refusal to allow the Aquarius to dock either.

Italy and Malta’s actions flout international maritime norms. Italy coordinated Aquarius sea rescues, and the Italian Coast Guard directly saved nearly 300 people and then transferred them to the NGO ship; Italy had the duty to promptly designate a safe place to disembark. The closest safe port Malta was a reasonable option.

Italy and Malta’s rejection of the ship’s passengers at the borders of their territorial waters, knowing some of those on board likely need international protection, denied those passengers the opportunity to exercise their right under EU, refugee, and human rights law to seek asylum.

Diverting the rescue ship to Spain – some four days’ away, with poor weather forecast – keeps the Aquarius away from the area where its search-and-rescue capacity is most needed, in international waters off the Libyan coast, putting other lives at risk. To ensure safe passage, 500 people were transferred off the Aquarius to Italian coast guard and Navy boats for the journey to Spain.

Blocking ships from disembarking rescued passengers could discourage both nongovernmental organizations and merchant vessels from responding to boats in distress. This episode should remind EU states that they share responsibility for saving lives at sea and making sure those rescued reach a place of safety.