A migrant waves from a boat June 30, 2019, later escorted to the Italian island of Lampedusa.
FILE - A migrant waves from a boat June 30, 2019, later escorted to the Italian island of Lampedusa.

Updated Aug. 14, 7:10PM

A Spanish rescue ship is headed to Italy's Lampedusa island after an Italian judge suspended the government's ban on the ship from entering Italy's territorial waters.

The rescue ship Open Arms, operated by a Spanish charity of the same name, has been floating in the Mediterranean for almost two weeks with 147 migrants on board.

According to an Open Arms statement, an Italian judge ruled Wednesday that Interior Minister Matteo Salvini's order against the ship violates international law in light of the "exceptionally grave and urgent situation due to the protracted stay of the migrants on our boat."

Salvini says he will appeal the court's ruling, but it is unclear if an appeal would stop the ship from docking on the tiny Mediterranean island.

Another rescue boat, the Ocean Viking — operated by Doctors Without Borders and SOS Mediterranean — is also looking for a safe port. It has 356 mainly young Sudanese men on board.

The ultra-right Salvini has barred rescue boats from Italian ports, saying Italy has done enough over the last several years and wants other EU members to accept migrants.

Under international law, a ship in distress is supposed to be allowed to enter the closest safe port. In many cases, this has been Lampedusa — the closest EU territory to Libya.

Thousands of sub-Saharan migrants looking to escape war, terrorism, and poverty try to reach the EU from Libyan beaches often aboard unsafe rafts and overcrowded boats.

Those not rescued are left to drown at sea. Migrants picked up the Libyan coast guard are returned to Libya and housed in detention centers.

Some of those centers are in the middle of the fighting between two rival Libyan governments.

Two missiles slammed into a detention center near Tripoli last month, killing 53.