WASHINGTON - President Donald Trump on Tuesday retreated from his demand that Congress give him $5 billion to build a wall along the U.S.-Mexico border, backing down amid acrimonious GOP infighting that left him with few options four days ahead of a partial government shutdown.

The news, delivered by White House press secretary Sarah Sanders in an interview on Fox News, represented a major shift from Trump's declaration last week that he would be "proud" to shut down the government to get the money he wanted for his border wall.

Democrats, who will reclaim the majority in the House just weeks from now, have consistently refused to give Trump anywhere near the $5 billion he wants.

But Sanders told Fox News Channel: "We have other ways that we can get to that $5 billion."

Sanders said the White House was exploring other funding sources and believed it could be legally done.

"There are certainly a number of different funding sources that we've identified that we can use, that we can couple with money that would be given through congressional appropriations that would help us get to that $5 billion that the president needs in order to protect our border," she said.

There was no immediate reaction from congressional Democrats to Sanders' comments.

Funding for the Homeland Security Department, Justice, Interior, Agriculture and other agencies - comprising a quarter of the federal government - runs out Friday at midnight absent action by Congress and Trump. The funding is all hung up over Trump's demands for the wall and Democrats and Republicans have been in a stand-off over how to resolve the dispute.

Sanders' comments come after a series of miscalculations by Republicans in recent days over how to try and get Democrats to sign onto $5 billion to pay for the construction of a wall along the Mexico border.

Last week, in a meeting with Senate Minority Leader Charles Schumer, D-N.Y., and House Minority Leader Nancy Pelosi, D-Calif., Trump said he would be "proud" to shut down the government over the issue, a statement that congressional Republicans openly said muddied their messaging that Democrats should be blamed for a shutdown.

Schumer and Pelosi, the likely incoming House speaker, have made clear to the White House they would not support giving the White House $5 billion to build a wall, and Democrats have largely closed ranks around them.

Republicans didn't have a way to proceed because they lacked 60 votes in the Senate to proceed to a vote on a spending bill.

House and Senate Republicans have been in talks with the White House in recent days looking at other ways to try and secure funding, outside of the traditional appropriations process. They have looked at redirecting already approved money, among other things, according to a person briefed on the talks who requested anonymity to discuss deliberations.

Trump has threatened to shut down the entire border if Democrats don't agree to give him the $5 billion, a threat that didn't appear to force capitulation.

Then on Monday evening, Senate Appropriations Chairman Richard Shelby, R-Ala., said he was anticipating a proposal from the White House, perhaps at 5 p.m., that never materialized. But the White House never promised a 5 p.m. proposal, and then Senate Republicans signaled they planned to move ahead on an overhaul of the criminal justice system this week, giving them very little time to negotiate a budget bill.

Meanwhile, the stock market has fallen precipitously in recent weeks, creating economic angst over Trump's agenda. Trump has attacked the Federal Reserve, among others, for the stock market's tumble, but it has rattled him, according to people who have spoken with him both inside and outside the White House.

The people spoke on the condition of anonymity to disclose the internal White House sentiment.

"We'll continue to have these conversations with both Senate and House Republicans and Democrats. Our team has been in constant communication," Sanders said. "We're going to continue to do that. I'm not going to negotiate here, but we've been talking to them just as recently as this morning."

Sanders' referenced a $1.6 billion border security bill that was agreed to in the Senate earlier this year on a bipartisan basis. However, in recent weeks Democrats have said they would support only $1.3 billion for fencing, and that the $1.6 billion package would not pass the House. That left it unclear how and whether the contours of the deal being described by the White House could take shape.

Congressional Republicans promised Trump several months ago that if he would delay a fight over the border wall until after the midterm elections, they would help him obtain the money in December. But those efforts never materialized, and he was under heavy pressure to avoid a partial government shutdown just a few days before Christmas.

“The advice he’s getting is to not do this, to just sign the bill, get this over with, and get into 2019 and then have this fight,” said Steve Moore, who was an adviser to Trump during the 2016 campaign.