Supporters of the DACA program protest outside the Capitol while lawmakers struggle Thursday to avoid a partial government shutdown. (Astrid Riecken/For The Washington Post)

Congress and President Trump are headed into new territory in their standoff over funding the federal government amid Democratic demands to resolve the immigration status of up to 1 million residents brought here illegally as children.

The uncertainty lies in this question: Who will win in the court of public opinion?

Public and private polling is giving each side something to hang their hat on if the federal government partially shuts down this weekend — an increasingly likely scenario. For Democrats, there is hope in surveys showing that more Americans would blame Trump and the GOP. For Republicans, the numbers offer this glimmer: In conservative states, the blame would shift to Democrats if the public perceives the immigration issue as the reason for the impasse.

"I think this is a big loser for both sides, I really do," said Sen. Susan Collins (R-Maine), a key swing vote on most issues.

The reality that public opinion would probably fall somewhere in between means the public could lose, too, because neither side will have an incentive to surrender — raising the possibility of a prolonged shutdown of government services.

In each of the two prolonged shutdowns of the last 25 years, the end came only when it became clear that the president's party — Bill Clinton's in the mid-1990s and Barack Obama's in 2013 — had won the battle of public opinion.

Everything you need to know about a government shutdown

In each case, the president, a Democrat, entered the budget showdown in a stronger position than the Republicans on Capitol Hill. For instance, a Washington Post-ABC News poll released on Sept. 30, 2013, hours before a 16-day shutdown began, found just 1 in 4 voters approved of how Republicans were handling negotiations, in which they refused to fund the rest of the federal government unless Obama agreed to their demand that no funds go toward the Affordable Care Act.

Three weeks later, Obama's own standing remained about the same — and the GOP's had shrunk to what was then an all-time low, with just 32 percent of voters holding a favorable opinion of the party. That's why Obama refused to give in to any substantive demands from Republicans in exchange for a deal to reopen the government.

Clinton held his ground 22 years ago as well, as the public rejected the GOP demand to slash funding for popular entitlement programs.

Both of those shutdowns led to additional bipartisan talks that produced broader budget deals. But the political fallout for Republicans was bad enough that, upon becoming Senate majority leader three years ago, Sen. Mitch McConnell (R-Ky.) declared there would be no shutdowns on his watch.

There is "no education," McConnell said then, "in the second kick of a mule."

The mule may be about to kick again, but it's unclear which party would get kicked the hardest.

Until Thursday, Democrats had framed the issue almost entirely around their desire for a deal to allow permanent status for nearly 1 million "dreamers" — undocumented immigrants brought here as children whose protections under the Obama-era Deferred Action for Childhood Arrivals program are set to expire in March.

More than 170 House Democrats have signed a letter saying they would not vote to keep the federal government open without a permanent solution for DACA recipients, in addition to several other budget demands.

The public has always supported the idea of letting dreamers stay in what is, for many, the only country they have any memory of; a CBS News poll released Thursday showed that almost 90 percent of those surveyed supported that position.

But the issue gets complicated once funding the federal government enters the mix. Just 46 percent of those who support permanent status for DACA beneficiaries say it's worth shutting down the government.

Moreover, a poll of 12 Senate battleground states conducted for the Senate Majority PAC — affiliated with Minority Leader Charles E. Schumer (D-N.Y.) — produced its own mixed results for Democrats.

Overall in those 12 states, voters would blame Trump and congressional Republicans rather than congressional Democrats if there is a shutdown, by 45 percent to 35 percent.

But the public view shifts if voters think the government is shuttering because of the immigration issue, particularly in five states that Trump won in 2018 by overwhelming margins and where Democratic senators face reelection in November: Indiana, Missouri, Montana, North Dakota and West Virginia.

In those five states, voters split the shutdown blame evenly between Trump and Democrats. That result shifts, 48 percent to 39 percent, onto Democratic shoulders if the DACA issue is what led to the shutdown.

In the other seven states, which are more diverse, immigration does not affect voter sentiment, with blame falling on Trump by a double-digit margin if there is a DACA-driven shutdown.

Any path for Democrats to win the Senate majority, either in November's midterms or in the 2020 election, rests on successfully defending almost all of those "Big Five" seats, as Schumer refers to his incumbents from deep-red states.

That probably explains why, in the last day or so, Democrats have dramatically shifted their messaging to say that their votes against continued government funding are about more than just immigration. "They don't have their house in order, and so this isn't about one policy issue. This is about their ability to do the most basic aspect of governing," Sen. Brian Schatz (D-Hawaii), one of the more liberal members of Schumer's caucus, said Thursday.

House Minority Leader Nancy Pelosi (D-Calif.) even argued, in a news conference Thursday, that the "main holdup" in a possible shutdown was a relatively minor dispute on budget levels for national security and domestic agencies.

Republicans, meanwhile, have repeatedly accused Pelosi and Schumer of blocking the continuing resolution, as the stopgap funding mechanism is known, because of one issue.

"The only reason we have to pass the C.R. today is because Democrats refuse to close on a spending agreement, taking it hostage for an immigration deal," House Speaker Paul D. Ryan (R-Wis.) told reporters Thursday.

If Democrats can make this looming shutdown about Trump and his ability to govern, they will be in a strong position to win the fight nationally and help the "Big Five" hold their own.

If Republicans can make it about immigration, the victory is probably theirs.

Read more from Paul Kane's archive, follow him on Twitter or subscribe to his updates on Facebook.