BARCELONA, Spain (AP) — Spain’s Foreign Ministry gave permission Saturday to an aid boat carrying 311 rescued migrants to set course for Spain after Italy and other Mediterranean countries did not answer its request to dock.

The boat belonging to the Spanish aid group Proactiva Open Arms saved 313 migrants Friday in waters near Libya. A baby and its mother were then evacuated from the boat.

Spain’s Foreign Ministry said Malta denied the aid boat permission to dock and the boat’s calls to Italy, France, Tunisia and Libya have gone unanswered.

The aid group said it now has permission to enter the Spanish port of Algeciras. On its Twitter account, Proactiva said “it will be many and difficult days sailing, but we have a safe port.”

In June, Italy and Malta denied entrance to another aid ship belonging to SOS Mediterranee Sea and Doctors Without Borders that was carrying over 600 rescued migrants. Spain granted it entry to end its weeklong saga at sea, as Spain’s new center-left government made the humane treatment of migrants one of its first policy decisions in contrast with the hard-line taken by Italy’s populist leaders.

According to the U.N. refugee agency, over 2,200 migrants have died trying to cross the Mediterranean Sea this year in unseaworthy smugglers’ boats and 117,540 migrants have reached Europe.