President Trump walks to board Marine One on the South Lawn of the White House on Nov. 29. (Jabin Botsford/The Washington Post)

President Trump has told confidants that a government shutdown could be good for him politically and is focusing on his hard-line immigration stance as a way to win back supporters unhappy with his outreach to Democrats this fall, according to people who have spoken with him recently.

Over the past 10 days, the president has also told advisers that it is important that he is seen as tough on immigration and getting money for a wall along the U.S.-Mexico border, according to two people who have spoken with him. He has asked friends about how a shutdown would affect him politically and has told several people he would put the blame on Democrats.

Trump’s mixed messages on a partial government shutdown could hamper the ability of congressional Republicans to negotiate with Democrats, whose support they need to pass spending legislation in coming weeks. Many Republicans said this week that a shutdown is a possibility they hope to avoid. Even inside the White House, aides fret about the possibility, saying it would not poll well.

White House Legislative Affairs Director Marc Short and other aides said the president did not want a shutdown.

“He’s not advocating for a shutdown in any way. We want to make sure our military is funded. We want to make sure our priorities are funded. That’s why we invited [Democrats] over to have a conversation about a deal,” Short told reporters at the U.S. Capitol late Thursday.

Sen. John Cornyn (Tex.), the second-ranking Republican senator, said that “when you run for office and you get elected and you are given the opportunity to govern, it strikes me as a bad idea to shut the government down. That seems like an abdication of responsibility.”

Sen. Thom Tillis (R-N.C.) added that any business that shut down abruptly “would go bankrupt. Actually, by definition they would be bankrupt. So, I think you have to avoid shutdowns at all costs.”

Up against a Dec. 8 spending deadline, House Republican leaders on Friday are expected to unveil a measure to extend current funding until Dec. 22, said multiple aides, who were granted anonymity to describe private deliberations. If talks on a longer-term deal to fund the government are not resolved by that time, GOP leaders are prepared to pursue another stopgap plan that would kick the talks into January, the aides said.

GOP leaders know they will probably need Democrats to help pass any spending bill because of potential opposition from House conservatives and because Senate Democrats can filibuster spending legislation.

House Speaker Paul D. Ryan (R-Wis.) said Thursday that Congress will pass a short-term bill “to keep talks going. Hopefully, people will decide to participate in these talks.”

Trump has waffled on the idea of a shutdown in the past. In the spring, he tweeted that he would like a “good” government shutdown and thought it would be useful to him. This fall, he mused to others in a White House meeting that he thought the debt ceiling — often used as a negotiating point in complex spending talks — should be ended for good and has told advisers that a shutdown could make the administration look impotent.

Sen. Richard J. Durbin D-Ill.), a leading Democratic negotiator on immigration and spending issues. (Aaron P. Bernstein/Bloomberg News)

Initially, Trump loved news media coverage of his deal this fall with Senate Minority Leader Charles E. Schumer (D-N.Y.) and House Minority Leader Nancy Pelosi (D-Calif.) that extended government spending and increased the debt limit for three months. The move was heralded by Democrats as a significant victory, while also allowing Republicans to jump-start their debate over tax cuts. In the wake of the deal, Trump even called Schumer and Pelosi to rave about their agreement.

But the more Trump talked to advisers, read polls and watched developments on Capitol Hill, the more he became frustrated that he was “looking like the chump in the deal,” according to one person who spoke to him about the issue, who along with others insisted on anonymity to speak candidly. This time, Trump wants his political base to see him as winning the contest, two advisers said.

Trump’s sudden shift is jeopardizing talks over exactly how much money should be spent by the federal government in the coming years and whether the new agreement might settle long-simmering immigration issues, lawmakers and aides said.

Trump announced in September that he will end Deferred Action for Childhood Arrivals, an Obama-era program that provides temporary legal protection to hundreds of thousands of immigrants brought to the United States as children. If Congress fails to act, those immigrants, commonly known as “dreamers,” face the risk of deportation starting on March 5.

After Trump’s decision, Democrats warned that any support for a new spending plan would rest on whether Republicans agreed to enact permanent protections for dreamers, among other issues. The two parties began talks on a potential compromise that has since stalled.

But Sen. Richard J. Durbin (D-Ill.), a lead negotiator for Democrats, complained this week that Republicans have backed off their initial pledge to broker a compromise. Durbin said he now doubts what he said Trump told him privately on Inauguration Day: “We’re going to take care of those kids.”

“For months, almost a year, he was consistent when it came to this topic. Lately, not so much,” Durbin said in an interview. “But he has a tendency to move back and forth. We hope we catch him at a good moment.”

Durbin, Cornyn, Senate Judiciary Committee Chairman Charles E. Grassley (R-Iowa) and others have been speaking for weeks about a potential deal. Republicans presented Durbin with plans drafted mostly by Cornyn that would make changes to border security, bolster immigration enforcement, revamp the E-Verify employment verification program and put limits on some forms of chain migration.

Durbin called the GOP proposal “a disappointment,” noting that the more than 400 pages of proposals included a new definition of an asylum seeker — a legal issue settled by an international treaty.

“That’s way beyond border security that they’re talking about,” he said.

Multiple GOP aides confirmed the details of the talks but said Democrats have yet to present a counteroffer.

“By threatening to shut down the government and refusing to negotiate, Senator Durbin is jeopardizing the fate of DACA recipients,” said a senior GOP aide, insisting on anonymity to speak frankly about the talks.

Inside the White House, Trump’s aides are trying to schedule a bipartisan meeting for next week with Ryan, Senate Majority Leader Mitch McConnell (R-Ky.), Schumer and Pelosi, according to a White House official with knowledge of the effort. Democrats backed out of a Tuesday meeting with Trump hours after he tweeted that he doubted he would be able to reach a spending deal with Democrats in part because of their position on immigration.

Part of the delay is driven by a focus at the White House and in GOP congressional leadership offices on the party’s tax plans. Several GOP congressional aides said in recent days that the contours of a spending deal probably won’t come together until the Senate has cleared a tax bill and negotiations begin with the House on a final compromise.

Sen. Lindsey O. Graham (R-S.C.), who has golfed with Trump in recent weeks, said he believes Trump is committed to averting a shutdown.

“North Korea is looming large,” Graham said. “We’d look like crazy people to shut down the government in light of all of our problems.”

Erica Werner contributed to this report.