Morocco, struggling with an influx of African migrants seeking passage to nearby Europe, on Thursday imposed a new rule requiring such travelers to fill out an online travel form for approval at least 96 hours before leaving home.

The procedure on a website carrying the Moroccan Foreign Ministry logo applies to a range of African countries whose citizens currently can enter Morocco without visas, except for Algeria and Tunisia.

The North African country has been grappling with a surge in migrants, arriving mainly on flights into Casablanca. Many intend to get into Europe and claim asylum by taking boats across a narrow Mediterranean strait to Spain, or scaling fences into the Spanish enclaves of Ceuta or Melilla bordering Morocco.

The new procedure “aims to facilitate passenger traffic … It will help Moroccan authorities know in advance the identity of travelers before boarding (planes),” reads a document issued by Morocco’s embassy in Mali and seen by Reuters.

Morocco has come under European Union pressure to reduce crossings of illegal migrants to Spain and wants Rabat to set up “disembarkation platforms” – centers where migrants’ asylum applications would be processed. Morocco has rejected the idea.

In Africa, Morocco offers visa-free entry to the nationals of Algeria, Tunisia, Mali, Niger, Senegal, Guinea Conakry, Congo Brazzaville, Gabon and Ivory Coast.

The new travel regulation took effect on Thursday for citizens of Congo Brazzaville, Guinea Conakry and Mali, according to a document from the Moroccan airline RAM.

Mali, Guinea and to a lesser extent Congolese nationals comprise the bulk of Europe-bound migrants coming to Morocco.

More than 40,000 African migrants have reached Spain’s southern Andalucia coast by sea from Morocco since January.