President Trump speaks at a Congressional Gold Medal ceremony honoring former senator Robert J. Dole on Capitol Hill on Jan. 17. From left, House Speaker Paul D. Ryan (R-Wis.), Senate Majority Leader Mitch McConnell (R-Ky.), Senate Minority Leader Sen. Charles E. Schumer (D-N.Y.) and House Minority Leader Nancy Pelosi (D-Calif.) (Evan Vucci/AP)

Congress will return Tuesday facing a familiar threat: President Trump’s demand for billions of dollars for his U.S.-Mexico border wall with the risk of a government shutdown if he doesn’t get it.

The lame-duck session gives the outgoing House Republican majority one final test of governing before Democrats take over in January and leave Trump with a weakened hand in pushing his priorities on Capitol Hill, even though the GOP still has a grip on the Senate.

But Republicans determined to deliver for Trump face the in­trac­table issue of immigration as well as Democrats emboldened by the midterm elections, as their expected House majority continues to grow to a dozen seats or more as votes are counted. Senate races in Arizona and Florida remain too close to call.

That has Democrats ready to resist the president’s demand for border money, now expected to be a minimum of $5 billion for the fiscal year.

“If it’s wall or nothing, they’re going to get nothing,” Sen. Patrick J. Leahy (Vt.), the ranking Democrat on the Senate Appropriations Committee, said Monday during a conference call with reporters.

Before breaking for the election, Congress funded 75 percent of the federal government, including the Pentagon, through Sept. 30. But the portion left undone includes the Department of Homeland Security, whose budget pays for border infrastructure.

That money will run out Dec. 7, raising the specter of a partial government shutdown if Congress and Trump can’t reach an agreement in the 12 legislative days before the deadline.

Trump refused to rule out a government shutdown at his news conference last week.

“We need the money to build the wall — the whole wall, not pieces of it all over,” said the president, who repeatedly insisted during his 2016 campaign that Mexico, not U.S. taxpayers, would pay for the wall.

Rep. Mark Meadows (R-N.C.), the chairman of the House Freedom Caucus who frequently talks to Trump, said he was “not optimistic” that Congress would be able to deliver “conservative wins that will get the base excited.” But he said the president and the GOP must be aggressive before Democrats rise to power.

“It’s going to have to be the president who decides whether he’s willing to fight for the funding,” he said. “The House certainly will.”

Bipartisan talks have repeatedly broken down over the past two years as Trump has insisted on wide-ranging changes to legal immigration policies and Democrats have mostly resisted what they consider wasteful spending on a physical wall. And after a bitter campaign in which Trump and Republicans lobbed raw anti-immigrant rhetoric at Democratic candidates — and with the president already preparing for a reelection fight in 2020 — Democrats appear to be in little mood for compromise.

Senate Majority Leader Mitch McConnell (R-Ky.) has said he wants to get Trump the $5 billion the president is seeking, but it remains far from clear how that result can be achieved, given Democratic opposition. A bipartisan agreement in the Senate earlier this year produced only $1.6 billion for the wall.

“I think a government shutdown, all that does is not only waste taxpayer dollars but waste enormous amount of private dollars . . . plus the fact that we look like idiots to the rest of the world,” Leahy said.

A broader immigration deal has proved elusive after several failed votes in the Senate and House. Yet, lawmakers are still talking about resolving the uncertain legal status of “dreamers” — young immigrants who arrived illegally in the United States as minors — to get Democrats to support more wall money.

Rep. Tom Cole (R-Okla.), chairman of the Appropriations subcommittee on labor, health and human services, said Republicans need to deal with unresolved issues now before Democrats take over.

“As many problems as you can solve this year, get ’em solved,” he said.

But McConnell on Wednesday mostly dismissed the notion that that sort of deal could come together in the next few weeks. “I can’t imagine, with all the things that we have to do here to wrap up this Congress, that we would revisit immigration, but who knows?” he said.

A fresh complication for any end-of-the-year deal is a Democratic effort to protect the investigation of special counsel Robert S. Mueller III from political interference by the Trump administration.

Trump’s decision last week to replace Attorney General Jeff Sessions with a loyalist has prompted new demands from Democrats and a few Republicans to add legislation shielding Mueller to the final spending bills.

McConnell has insisted that such a measure is unnecessary.

Republicans and Democrats will return to a new, sometimes discordant reality, with lawmakers working on unfinished business, including a farm bill, and newly elected members joining them in Washington for orientation.

House Republicans will vote Wednesday on their new leaders, with Rep. Kevin McCarthy (Calif.) expected to easily weather a challenge from Rep. Jim Jordan (Ohio) to become minority leader next year. Reps. Steve Scalise (La.) and Liz Cheney (Wyo.) are running unopposed for minority whip and conference chair, respectively.

Speaker Paul D. Ryan (Wis.), who came to power in October 2015 when the GOP had a commanding majority of 247 seats, will leave in January with Republican numbers likely to be around 200.

The exact proportions of the next House remain in flux, but with just 56 returning Republicans serving before 2011, only about a quarter of the GOP conference will have experienced being in the minority.

Rep. Tom Cole (R-Okla.) said it will be a rude adjustment for some. “Frankly, it’s a rough business,” he said. “They can put any awful vote in front of you that they want to. You are less important, and . . . don’t expect your fundraising calls to be returned quite so promptly or the response to be quite so generous. That’s just the reality of power.”

Democrats will vote on their leaders at the end of the month, and although Minority Leader Nancy Pelosi (Calif.) is moving aggressively to secure support for the speaker’s gavel, a rump caucus is maneuvering to contest her ascension.

“We’re the voices of a silent majority who want new leadership & to protect new members,” Rep. Seth Moulton (Mass.), one of the leaders of the anti-Pelosi push, tweeted Friday.

So far, that silent majority has no alternative, but the jockeying is expected to accelerate this week, especially with the new members, many of whom distanced themselves from Pelosi during the campaign.

Of the unfinished work, the farm bill has languished amid a partisan clash about whether some recipients of federal nutritional benefits ought to be required to work. Trump publicly backed the work requirements as recently as this week, but Democrats remain opposed.

The policy’s top advocate on Capitol Hill — House Agriculture Committee Chairman K. Michael Conaway (R-Tex.) — will relinquish his post in January. “This week’s election results don’t change the circumstances in farm country,” Conaway said in a statement Friday. “I remain 100 percent committed to completing the farm bill this year.”

In the House, pro-Trump conservatives are still entertaining whether to force a vote on impeaching Deputy Attorney General Rod J. Rosenstein.