Italy’s far-right interior minister, Matteo Salvini, who seems ready to vie even with his hero Donald Trump in cruelty toward the most vulnerable, declared victory on Monday in his campaign to defy international law by refusing to accept more than 600 migrants rescued from the Mediterranean this weekend.

Salvini, who is also Italy’s new deputy premier, put his Trump-inspired “Italians First” campaign slogan into practice over the weekend by closing the country’s ports to a rescue ship, the Aquarius, which is carrying 629 migrants saved from drowning, including 123 unaccompanied minors, 11 babies, and seven pregnant women.

The migrants were left stranded at sea, with no idea where they might land until Spain’s new socialist prime minister, Pedro Sánchez, intervened on Monday to offer the migrants safe haven in Valencia.

Spanish journalists on board the rescue vessel have reported the increasingly desperate plight of the migrants over the past 24 hours.

Valencia, however, is 800 nautical miles away from the point between Italy and Malta, where the ship has been stranded, and took on emergency rations of food on Monday.

Malta’s prime minister, who had resisted Italian pressure to take the migrants, thanked Spain’s new government for defusing the crisis.

Since Italy’s navy had coordinated the initial rescue effort, and even transferred some of the migrants its own navy had saved to the rescue ship staffed by volunteer aid workers, it was obliged by international law to ensure their safety.

But Salvini, who channeled Trump last week by telling reporters at a refugee camp in Sicily that Tunisia “isn’t exporting gentlemen, it seems more often they’re exporting convicts,” responded defiantly to calls for mercy, even from the Vatican. On Sunday evening, he posted an image of himself on Twitter with his arms crossed above the message, “We are closing the ports,” rendered as an Italian hashtag.

Salvini’s nationalist Lega party has promised to expel the 600,000 undocumented immigrants who have arrived in Italy since 2014, mostly from Africa, but he was only able to close the country’s ports with the support of his coalition partners in the populist Five Star Movement, which leads Italy’s new coalition government.

As the crisis was unfolding over the weekend, the Five Star leader, Luigi Di Maio, shared a tweet from Trump in which he praised the coalition’s prime minister, Giuseppe Conte.

While Trump was alienating America’s other close allies at the Group of 7 meeting in Canada this weekend, Conte had echoed the American president’s call for Russia to be re-admitted to the club it was suspended from for seizing Crimea and fomenting war in Ukraine.

Salvini, who met with Trump during the 2016 campaign, has also called for an end to sanctions on Russia.

After his party made a strong showing in the March elections, Salvini posted an image of himself on Twitter beaming in front of a bookshelf adorned with a “Make America Great Again” hat and a photograph of Vladimir Putin.

Also on the shelf was a copy of a book about the cooperation agreement with Putin’s United Russia party that Salvini signed in Moscow last year on behalf of his own far-right party. While the details of that agreement were not made public, Salvini told Russians at the time that his goal was to work “so that Italy has real parliamentary elections, just as open as in your country.”