BRUSSELS — As Europe makes gains in its battle to stop migrants from reaching its shores, newer routes are seeing fresh traffic, a measure of the demand to reach safer lands and the dangers that await some of the world's most vulnerable people.

Flows across the central Mediterranean Sea from Libya to Italy plunged in mid-July after Italian authorities struck an unusual deal with local Libyan militias to clamp down on human smuggling. But smaller routes have experienced an uptick, with traffic from Morocco to Spain steadily increasing and more people undertaking the perilous Black Sea passage from Turkey to Romania.

The surges do not seem to be directly related to the Libyan clampdown, but they are illustrative of migrants' tendency to find new paths to Europe as old ones close, officials and analysts say.

"These flows aren't necessarily the same people, but they do demonstrate that the migration routes and flows are constantly shifting," said Elizabeth Collett, director of the Migration Policy Institute Europe, a think tank.

The sharp drop-off in flows from Libya — from 22,155 people in June to 2,887 in August — has been a relief for European leaders fearful of restive voters who have started to rebel against the arrival of more migrants. Germans last week awarded Alternative for Germany, a far-right, anti-
migrant party, nearly 13 percent of the vote in the national election. That came after June local elections in Italy that rewarded anti-immigrant politicians.

But the bottled-up traffic comes at a steep human cost, trapping migrants in the shifting winds of Libya's conflict, where they often are forced into detention centers against their will and made to do labor that is little different from slavery.

Farther south, in the sub-
Saharan African nations that are the source of much of the migration through Libya, the closed route has led at least some migrants to take new paths, sometimes at the cost of their lives. Countries such as Niger are struggling to accommodate refugees from neighboring countries with no escape valve and often only limited assistance from Europe.

"When you shut down the major routes, you see a proliferation of smaller, potentially more expensive routes," Collett said. "The fundamentals are not changed in that there are a number of simmering conflicts in sub-Saharan Africa."

European leaders have pressed on several fronts to stem migration after a burst in 2015 of more than a million asylum seekers. Afterward, European Union leaders struck a $7.1 billion deal with Turkey to seal its borders and stanch the flow. They also started to work intensively in sub-
Saharan Africa, tying development aid to countries' willingness to accept returnees from Europe and offering fresh assistance in exchange for pledges to cut flows.

Before Libyan strongman Moammar Gaddafi's 2011 downfall, the Italian government made similar deals with him. But since his death, the absence of a strong central authority has made exerting control deeply difficult — that is, until Italy's outreach to local leaders this summer.

Italian Interior Minister Marco Minniti, a former spy chief, masterminded the plan, which funds the local governments that, critics say, are often little more than militias deeply entangled in the smuggling business themselves. Minniti denies such charges.

Italy and the E.U. also have worked to train and equip the fledgling Libyan coast guard to turn back migrant ships, an effort that has stopped up to 16,000 people so far this year, according to data compiled by the U.N. refu­gee agency. But the Libyan coast guard also has been implicated in abuses.

And the Italian government has engaged the warring national factions within Libya, hosting Prime Minister Fayez Serraj, the head of the U.N.-installed unity government, in July, and Gen. Khalifa Hifter, aligned with a rival eastern Libyan government, last week.

So far this year, more than 104,000 people have entered Italy, most of them before mid-July. Even though the flows have settled, many migration analysts are hesitant to declare the route closed. The instability of Libya makes any long-term predictions impossible. A small uptick in departures from the smuggling hub of Sabratha after fighting increased there starting Sept. 17 was the latest reminder of the tenuous situation, said Carlotta Sami, a Rome-based spokeswoman for the U.N. refu­gee agency.

"It's still a bit early to say that the route from Libya to Italy has stopped," she said.

And in the nations leading into Libya, migration traffic also remains volatile. Niger has led a crackdown on the main smuggling route to Libya, but that has caused smugglers to search for new, more dangerous routes northward, as well as try to expand their paths into Algeria, Sami said.

"The number of people that are found dead or abandoned in the desert are increasing," she said.

The U.N. refugee agency has pushed for more legal paths for asylum seekers to reach Europe, Sami said, a step the agency says would ease pressure on irregular migrant routes. The agency also favors increasing the range of reunification policies that enable family members to travel to Europe legally if a relative is already there, Sami said.

This year, more than 19,000 migrants have arrived on Spanish shores, compared with about 9,100 over the same period last year. Unlike on the route from Libya, most of those landing in Spain are Moroccan nationals. The increase has caused nervousness among leaders and concerns about what will happen during the height of the migration season next year, after smugglers have had a chance to regroup. Migration numbers typically drop in October as temperatures fall and seas grow choppier.

And in a possible measure of smugglers' resourcefulness, six boats this year have landed in Romania after setting sail from Turkey, carrying 572 people. The number is so small that it barely registers against pressures elsewhere, but border officials say that smugglers may be testing vulnerabilities.

"We perceive it as something that is being tested as a possibility," said Ewa Moncure, a spokeswoman for Frontex, the E.U. border and coast guard agency. "The numbers are definitely lower, but the crisis is not over."