The Democrats onstage saw themselves as morally courageous. American voters, it turned out, saw a group of politicians hopelessly out of touch.

Standing side by side at a primary debate in June 2019, 10 of the party’s candidates for president were asked to raise their hand if they wanted to decriminalize illegal border crossings. Only one of them held still.

Six years later, the party remains haunted by that tableau. It stands both as a vivid demonstration of a leftward policy shift on immigration that many prominent Democratic lawmakers and strategists now say they deeply regret, and as a marker of how sharply the country was moving in the other direction.Last year, 55% of Americans told Gallup that they supported a decrease in immigration, nearly twice as many as in 2020, and the first time since 2005 that a majority had said so. The embrace of a more punitive approach to illegal immigration includes not only white voters but also working-class Latinos, whose support Democrats had long courted with liberal border policies.

“When you have the most Latino district in the country outside of Puerto Rico vote for Trump, that should be a wake-up call for the Democratic Party,” said Rep. Vicente Gonzalez, D-Texas, who saw Trump win every county in his district along the border with Mexico. “This is a Democratic district that’s been blue for over a century.”

How the Democrats reached this point, and their continued struggles on immigration, is a decades-long story of political failures, missteps, misreadings and misplaced bets — and some shrewd Republican moves.

“We got led astray by the 2016 and the 2020 elections, and we just never moved back,” said Sen. Ruben Gallego, D-Ariz., who introduced an immigration and border security plan in May. “We looked feckless, we weren’t decisive, we weren’t listening to voters, and the voters decided that we weren’t in the right when it comes to what was happening with the border.”

What the party does to change its approach — and to change how voters see Democrats on immigration — may be the most consequential and difficult decision it faces as it searches for a path back to power.

But while there is party-wide agreement that Democrats have a problem on immigration and border security, there is no consensus on how to fix it.

Some are pushing for a course correction they see as overdue. A new proposal from the Center for American Progress, the party’s leading policy shop, calls for expanding legal immigration while embracing ideas long championed by conservatives, including making it harder for migrants to qualify for asylum.

Neera Tanden, the center’s CEO, said the plan acknowledged a reality that Democrats had long resisted: They must embrace new immigration restrictions in order to have the credibility with voters to fight the far more expansive plans of the Trump administration.

“I’m happy to argue with Stephen Miller or anyone else about why they are wrong,” she said. “But the way we’re going to be able to do that is to also honestly assess that the border has been too insecure, that it allowed too many people to come through and that we need to fix that.”

Many on the left vehemently disagree, insisting that more conservative policies will only aid what they see as an insidious and ambitious effort by the Trump administration to demonize and deport Black and brown immigrants who have been in the country for years, remaking the fabric of a nation that once took pride in its diversity.

“Democrats have to stop talking about the issue of immigration within a Republican frame,” said Rep. Ayanna Pressley, D-Mass. “This has nothing to do with law and order. This is about power, control, terror, and it is about racism and xenophobia. Donald Trump wants to make America Jim Crow again, and then some.”

Complicating Democrats’ efforts to chart a new path is the fact that the party’s debate is unfolding in the midst of what it sees as a national crisis. The Trump administration is pursuing the harshest crackdown on immigrants since World War II. Raids and patrols by masked officers, detentions at courthouses and workplaces, the promises to arrest and deport millions, and the deployment of National Guard troops against protesters have immigrants who lack legal status and even some naturalized citizens running scared and lying low.

Some Democrats believe their party can find its path forward by looking to the past.

It was under President Bill Clinton, a Democrat, that Congress broadly expanded the grounds for deportation and that border enforcement officers saw their ranks increase sharply. The next Democrat to win the White House, Barack Obama, promised to pass comprehensive immigration legislation, including a pathway to legal status for an estimated 12 million immigrants.

Seeking Republican support, Obama also pursued aggressive enforcement, deporting more immigrants in his first term than any president had since the 1950s. But his attempts to balance the two priorities ultimately failed: His plan to modernize the immigration system stalled in Congress, while his executive actions to aid students, workers and families who lacked legal residency status were challenged in the courts. Disillusioned advocates denounced him as the “deporter in chief.”

Then came Trump, who rode down the golden escalator at Trump Tower to announce his presidential campaign with promises to build a “great wall” along what he described as an out-of-control southern border and to expel migrants he condemned as criminals, drug traffickers and rapists.

As Trump competed for his party’s nomination, Hillary Clinton was under pressure in the Democratic primaries from Sen. Bernie Sanders on the left. Immigration activists persuaded her to break with Obama’s approach — not to mention her husband’s — and pledge not to deport illegal immigrants beyond violent criminals and terrorists. But that promise fueled Trump’s candidacy more than it helped hers. He hammered away at her, saying she wanted to “abolish” the country’s borders.

Trump’s restrictive policies, particularly the separation of children from their families, inspired a broader backlash: By the time he left the White House, more Americans favored increasing immigration than opposed it for the first time in six decades of Gallup polling.

But soon after President Joe Biden entered office, illegal crossings at the southern border began to increase, as pandemic lockdowns were lifted and would-be migrants in Central America responded to Washington’s changed tone.

Some aides urged Biden to avoid the subject and stay focused on the pandemic, the economy, Afghanistan and Russia’s invasion of Ukraine, issues more politically favorable to him.

Republican governors made the subject impossible to avoid.

The first buses of migrants chartered by the Texas Division of Emergency Management pulled into Washington from Del Rio, Texas, in April 2022. The White House dismissed the effort, organized by Gov. Greg Abbott, as a “political stunt.” But the buses kept rolling.

Over the next two years, Texas sent nearly 120,000 migrants to cities such as New York, Chicago and Washington. Doug Ducey, then the governor of Arizona, sent buses to Denver, and Gov. Ron DeSantis of Florida flew migrants to Martha’s Vineyard, Massachusetts.

As Democratic governors and mayors struggled to house and feed the arrivals, Republicans blamed Biden for the crisis engulfing liberal cities.

Democratic mayors and governors begged Biden to authorize emergency aid and work permits for the migrants. Some took their criticisms public in frustration with what they saw as White House inaction.

But Biden aides were locked in furious debates over how, and how fast, to dismantle Trump’s policies and what should replace them. That infighting crippled the administration’s ability to respond quickly.

Congressional Democrats tried to step in, striking a compromise on a bipartisan border bill that would have made illegal entry more difficult while allowing admitted migrants to receive work permits more quickly. But Trump pressed Republicans to torpedo it, to deny Biden a victory and keep the issue inflamed heading into November.

Biden finally responded to the crisis in June, issuing an executive order preventing migrants from seeking asylum at the U.S.-Mexico border when crossings surge — the most restrictive border policy any modern Democrat has instituted.

Unlawful crossings plummeted. But it was too late to change voters’ perceptions. Trump maintained his advantage on the issue when Vice President Kamala Harris replaced Biden on the ticket.