MADRID (AP) — The smugglers took Rodriguez Tankeu's savings and disappeared, leaving the 25-year-old bewildered near Tripoli, the Libyan capital. The former car mechanic headed to Algeria, where he saw, one by one, all the spots on engine-powered boats go to wealthier migrants.

Broke, tired and desperate, he moved further west.

"Morocco was my last hope," he says. "It was either making it to Europe or giving up for once and for all."

Algeria and Morocco are increasingly popular points of departure for economic migrants and asylum-seekers whose arrivals more than doubled last year along the hazardous Western Mediterranean passage into Europe.

The trend comes as Libya and Turkey have worked to stop migrants from departing for Europe. The controls helped reduce the number of migrants arriving in Italy by one-third and by more than 70 percent in Greece last year, according to European border agency Frontex.

Spain worked to help shape the European Union's approach to curbing immigration, in large part by training and funding governments in countries such as Turkey. Yet it is the EU member that could face most pressure if migrants keep moving westwards. The Spanish prime minister has called on the bloc to increase funding for southern European countries.

Observers say that recent social unrest in the northern Moroccan Rif region has been a contributing factor to the reshaped migration patterns. The focus on the internal conflict has relaxed policing of migrant departures and Moroccans of young age have also joined Algerians and sub-Saharan Africans seeking better economic opportunities.

In Morocco, Tankeu considered buying a fragile inflatable boat to brave the strong currents at the mouth of the Mediterranean. But having grown up in Douala, a coastal hub in his native Cameroon, he knew about the perils of a sea journey. Plus, he had no cash left.

The young man eventually joined hundreds of others who assemble in forest camps to get through the fence to Ceuta, a Spanish enclave and tiny pocket of official European soil in Africa's northern edge. Three times he was intercepted, and three times he returned. Last summer, on his fourth attempt, he finally made it to the other side.

"I've paid a high price for my European dream. I wouldn't do it again," Tankeu said at a charity-run migrant center in Madrid where he receives advice while he navigates Spain's intricate bureaucracy for asylum-seekers.

According to the International Organization for Migration, more than 28,300 migrants entered Europe via Spain last year. At least 6,200 people crossed the borders of Ceuta and Melilla —another Spanish territory— either jumping barbed-wired fences or hidden in vehicles.

But the highest numbers washed up in boats or were rescued off the Spanish coast: arrivals by sea totaled 22,100 in 2017, up from 8,100 in the previous year. Their sharp increase over the last quarter worries observers about what's to come.

"The current European policies are the perfect breeding ground for intensifying the flows along the Western Mediterranean route," says Estrella Galan, secretary general of CEAR, a non-governmental organization working with asylum-seekers.

"If we don't change our policies we are going to continue an endless cycle of replicating migration patterns from one location to another," she says.

Spain negotiated cooperation deals with transit countries more than a decade ago, offering funding and training to coast guards and security forces in its southern regions. The first repatriation agreements with sub-Saharan countries and pledges of development funds helped reduce a wave of nearly 32,000 arrivals to the Canary Islands in 2006.

The bill of this effort is costly. Speaking to Spanish daily El Mundo, Spain's state secretary of security Jose Antonio Nieto recently defended the deals with Algeria and Morocco saying they are "essential partners" and that "chasing mafias and human trafficking networks is the top priority."

Prime Minister Mariano Rajoy has often showed off the "success" of Spain's model before other European colleagues. But at the end of a Southern Europe summit in Rome this month, he also urged the EU to increase funding for member states at the forefront of the bloc's external frontiers.

NGOs and human rights organizations say that Spain also needs to draw its own plan to face the new situation. A Human Rights Watch report last summer criticized the country's treatment of migrants upon arrival, from immediate detention in poor facilities to obstacles for filing asylum applications.

The shortcomings became evident in December, when the death of a 36-year-old man brought unwelcome attention to an unfinished prison where more than 500 newly arrived Algerians had been housed.

As relatives cast doubts on the authorities' explanation that the man killed himself, public pressure increased over how migrants —some of them minors — were being held in a facility for criminals. Two weeks after the man's death, the Interior Ministry ended up relocating them elsewhere.

The uptick in the number of casualties at sea —from 169 deaths in 2016 to 223 last year— is an additional source of concern. Adolfo Serrano, chief coordinator of Spain's rescue services in Tarifa, says that most migrants end up in the water when something fails, both in high-capacity boats carrying a lot of passengers and small rafts "similar to the toys that children use in the beach."

And, like elsewhere in the Mediterranean, some NGOs have also been blamed as part of the problem.

Helena Maleno, a human rights activist who alerts rescue services about dinghies in the Mediterranean Sea, is now facing possible criminal charges in Morocco for allegedly aiding human traffickers. Spanish investigators initially pursued the investigation.

Maleno, who founded the Walking Borders NGO in the Moroccan city of Tangiers, says her phone and social media contacts are available to migrants who often share them and use them to plea for assistance. A prosecutor in Spain's National Court dropped the case last year, but the investigation had already extended to Morocco, where a magistrate is questioning the activist this month.

Spain's Interior Ministry didn't return calls or emailed questions for comment.

"I hope the case will be shelved," Maleno told The Associated Press last week. "I will make my case before the judge in order to clear my name, but also because this can't set a precedent for other organizations who are working to safeguard the right to life in the Mediterranean."