The surge of people from Africa, Asia and the Caribbean who have been trekking in ever-greater numbers across the Americas in hopes of reaching the United States presents the new U.S. administration with a conundrum.
Most of them arrive without identification or travel documents, and U.S. security officials worry that global terrorist networks could use the illicit flows as cover to smuggle operatives into the U.S. — as the Islamic State has done in Europe.
But deploying ever-larger border walls, of the kind that President-elect Donald Trump has pledged, will do little to resolve the problem: Most of these long-distance migrants surrender voluntarily to U.S. border officers, and claim protections guaranteed under U.S. and international law.
The dynamic at the Southwest border has changed. And barricades, many immigration experts have begun to argue, are an investment in the last war.
What is needed now, immigration experts are realizing, is the ability to quickly determine who among this much more diverse new group of migrants is fleeing war and political repression — and who may simply be coming to the U.S. in hopes of earning a better living.
The dilemma has never been more acute, as the nature of immigration at the Southwest border shifts from hundreds of thousands of Mexicans attempting to cross furtively into the U.S., to more people from faraway conflicts and centers of violent political turmoil — migrants who have rights to asylum and assistance.
"The challenge at the border is very different," said Cecilia Munoz, a senior adviser to President Obama and head of the White House's Domestic Policy Council. "I don't think there is anybody in (the Department of Homeland Security) who really believes we can enforce our way out of this problem."
The government has invested heavily in stemming the historic flow of undocumented migrants from Mexico, deploying new technology and increasing the size of the Border Patrol from about 10,000 agents in 2004 to 21,000 today. This has greatly increased the risks and cost of the trip.
The Pew Research Center now estimates that more Mexicans are returning to Mexico than are migrating to the U.S. — a product in part of economic growth south of the border, as well as reduced opportunities in the U.S. since the recession nine years ago.
Today's unauthorized arrivals are a more diverse group, both in terms of where they are coming from and the reasons that propelled them to embark on their long, dangerous journeys. They include hundreds of thousands of people fleeing the violence and dire poverty of Central America, as well as smaller but rapidly growing numbers from Haiti, India, Ghana and beyond.
Unlike generations of Mexicans before them, many of these would-be Americans present themselves to U.S. authorities and asking to be admitted on humanitarian grounds.
About 7,300 people from outside Latin America were apprehended while trying to slip across the southern border in the 11 months ending in August, while an additional 48,000 showed up at official ports of entry without the necessary paperwork and were deemed inadmissible.
Careful vetting of those who request asylum is one important step, officials say. Authorities in 2015 detained 100 people at the U.S.-Mexico border whom they believed might have ties to terrorism suspects in other nations, according to figures released by the office of U.S. Rep. Duncan Hunter, R-Calif.
"These smuggling routes are a potential vulnerability to our homeland," retired Marine Gen. John F. Kelly, former head of the U.S. Southern Command and Trump's choice to lead the Department of Homeland Security, said in congressional testimony in 2015. "Terrorist organizations could seek to leverage those same smuggling routes to move operatives with intent to cause grave harm to our citizens, or even bring weapons of mass destruction into the United States."
But many immigration experts are skeptical that spending more money on fortifying the border will do much to stanch the flow.
"When you have mixed flows, in many ways you have a more complicated enforcement challenge," said Doris Meissner, a senior fellow at the Migration Policy Institute in Washington who served as immigration commissioner in the Clinton administration. "You need to decide as a country to whom you are going to provide protection to stay in the United States, and then separate those people from those who are economic migrants and need to be returned."
Such decisions aren't handled by border agents, she noted. They are handled by asylum officers and immigration judges, parts of the immigration system that have not benefited from the kinds of budget increases awarded to border enforcement.
The result is an enormous backlog. The number of cases awaiting resolution in federal immigration courts has tripled in the last decade, reaching an all-time high of 526,175 at the end of November, according to figures collected by the Transactional Records Access Clearinghouse at Syracuse University. Cases had been pending an average of 678 days.
The diverse backgrounds of those seeking to enter the U.S. has added to delays. Immigration attorneys say there are not enough translators at border crossings and in detention centers who are proficient in Hindi, Bengali and the many other languages spoken by the new arrivals.
Lawyers and activists also complain that immigration judges lack detailed knowledge about the political and social climate in countries such as Bangladesh and India, and may be too quick to send them home.
Though both countries are nominally peaceful democracies, political feuds and ethnic and religious discrimination are widely cited as factors motivating some citizens to flee.
Migrants' chances of being granted protection are significantly higher if they have legal representation. But the government does not pay for this, and many struggle to find a lawyer they can afford or who will take their cases pro bono — especially if they are in custody.
The bigger the backlog in immigration court, the harder it is to find room for new arrivals in the detention system. That has meant releasing migrants with a notice to appear in court at a future date, a practice that critics argue only increases the incentive for others to attempt the trip.
"You have to stop rewarding people for coming here illegally," said Mark Krikorian, executive director of the Center for Immigration Studies, which favors restrictive immigration policies. "You are just going to get more and more of them."
He said the Obama administration has often set the bar too low for determining who is has a "credible fear" of persecution and is thus eligible for asylum consideration.
"The fact is that the reason somebody is traveling thousands of miles from sub-Saharan Africa or South Asia to the United States is because they have a relative here who has a dishwashing job for them and a couch for them to sleep on," he said. "If they were actually fleeing for their lives, or fleeing imprisonment, they would have applied for asylum in the first safe country they got to, and every single one of those people has passed through multiple countries where they were not being persecuted."
Other experts, however, worry that lives could be endangered if asylum officers don't cast a wide net.
"The consequences of denying asylum to people who need it are so dire, we should take every effort to not deny asylum to someone who needs it," said Stephen Legomsky, who served as chief council for Homeland Security's immigration services agency from 2011 to 2013.
He believes one of the best long-term strategies is to help address the conditions that are driving people to flee their homelands.
The Obama administration has increased the amount of aid the U.S. provides to Central American countries, from which large numbers claim asylum out of fear of gang violence.
U.S. officials are also working with the government of Costa Rica so that those Central Americans petitioning for asylum in the U.S. can have their cases considered there, rather than embark on the dangerous trek north.
That kind of regional collaboration is critical, humanitarian officials say.
Just how hard it is to strike a balance was underscored by a recent surge in the number of unauthorized Haitian arrivals that overwhelmed authorities on both sides of the U.S.-Mexico border.
Most of these migrants spent years in Brazil, where they went in search of employment after an earthquake devastated their Caribbean Island nation in 2010. But Brazil is now in the midst of its worst recession in decades, leaving many Haitians out of work and looking to the north for help.
Until recently, most of those who made it to the U.S. border were admitted at least temporarily on humanitarian grounds. U.S. authorities believed it was too dangerous to send them home.
When officials realized that thousands more Haitians were headed their way, the administration decided in September to start detaining and removing them from the U.S. — either back to Haiti, or if they preferred, to Brazil.
Less than two weeks after the new policy for Haitian migrants was announced, Hurricane Matthew wreaked havoc on the island and deportation flights were temporarily suspended.
Detention facilities quickly filled up, and Haitians were again released on humanitarian parole.
U.S. Immigration and Customs Enforcement has signed contracts with additional detention facilities to handle the surge of migrants arriving from countries other than Mexico, Philip T. Miller, a senior ICE official, said during a recent call with reporters.
He said detention is mandatory for most recent arrivals to the U.S. "It is our responsibility to ensure we have sufficient beds."
The lack of consistency in U.S. immigration policy poses a challenge to those trying to help these new migrants, many of whom exhausted what resources they had trying to reach the U.S.
When ICE notifies the Catholic Charities Dioceses of San Diego about a Haitian woman and child who are about to be released on humanitarian grounds, there is federal funding available to find them a place to stay or pay for a plane ticket to where they might have friends or family, said Robert Moser, the group's executive director. The same is not true if the people released are from Nigeria.
"Both have the same needs. Both are coming for the same reasons, but the place of your birth determines what you are eligible for," Moser said.
In the absence of more generous government policies, he said, aid groups hope local communities will step in to provide for those in need.
"People are going to come no matter what ... because their choices are a lot worse if they stay," Moser said. "If people with good hearts act in a good way, they can be an alternative to hateful rhetoric."