Spanish Prime Minister Pedro Sanchez urged greater cooperation on migration while making his first visit Monday to Morocco, a jumping-off point for a growing number of migrants trying to reach Spain and get a foothold in Europe.

Spain is one of the North African kingdom’s strongest European allies, and enhanced collaboration on all levels was a focus of Sanchez’s visit. It was among the topics discussed at a lunch hosted by Moroccan King Mohammed VI, the official MAP news agency said.

Controlling migration from Morocco to Spain was the focus of Sanchez’s talks with Moroccan Prime Minister Saad Eddine El Othmani.

“Migration is a shared responsibility, and we need to strengthen our cooperation,” Sanchez said at their joint news conference.

El Othmani said Morocco “is doing everything in its power” to fight illegal immigration, but insisted the complex issue “cannot be solved solely by the security approach.”

“Despite the importance of security, we must focus on the development of countries of departure in Africa,” Othmani said.

Many migrants in Morocco who embark for Spain are sub-Saharan Africans.

Moroccan authorities say the kingdom prevented 65,000 migrants from crossing to Spain in 2017. However, Morocco says it cannot be the region’s immigration police.

Morocco’s place as a point of passage has grown with Italy’s refusal to take in migrants who try to cross the Mediterranean Sea from Libya. The Libyan coast guard, with help from the Italian government, increasingly has intercepted flimsy boats launched by migrant smugglers.

Migrants head to northern Morocco with the aim of crossing the Strait of Gibraltar to Spain or climbing over high fences to reach the Spanish enclaves in North Africa, Ceuta and Melilla.

Nearly 47,500 migrants arrived in Spain by sea since the start of the year, while 564 died or went missing while attempting the voyage, according to the International Organization of Migration.

Morocco, along with Tunisia and Algeria, has refused to serve as an immigration reception and processing center, an idea proposed by the European Union. Morocco instead wants more EU funding to help manage migration across its borders.

Morocco is scheduled to host an international U.N.-sponsored conference on migration on December 10-11.