WASHINGTON — Last week, President Donald Trump found himself caught between "The Swamp" and his political base. This week, he caved to both.

He would be "proud" to shut down the federal government, he told Democratic leaders last Tuesday, “if we don’t get what we want" — over $5 billion in funding for a border wall that he long promised would be underwritten by Mexico.

Republican leaders in Congress, who didn't share the president's enthusiasm for claiming shutdown blame, appeared to have persuaded him to back away from the political inferno when the Senate passed a short-term funding measure without his wall money on Wednesday.

Vice President Mike Pence stopped short of guaranteeing Trump's signature on a bill when he spoke to lawmakers earlier that day — but he told them the president was open to approving it and it was widely assumed across the political spectrum that he would do so.

But to let the government stay open without getting his wall money, the president's biggest supporters in Congress and conservative media warned him in the hours that followed, would mean abandoning his political base.

"I think they are very concerned that he is not fulfilling his campaign promise based on the phone calls I’ve gotten in my office,"said Rep. Mark Meadows, R-N.C., a close ally of Trump's and the chairman of the conservative Freedom Caucus.

"Fox & Friends," the television show Trump is glued to in the mornings, challenged him Thursday.

"I think a lot of people who voted for President Trump counted on him on this particular issue," host Jedediah Bila said. "I think their feet were to the fire. And you see a lot of people around the country saying: ‘Hold on a second. You told us that you weren’t afraid to shut down the government, that’s why we like you. What happened? You just gave in right away?’”

Others in conservative circles were more caustic.

"In the end, we’ll probably find out 'wall' was Trump’s 'safe word' with Stormy Daniels. It’s just something he blurts out whenever he’s in trouble," Ann Coulter wrote in a Breitbart column.

And so by Thursday, as the House was getting ready to send the bill to the president, Trump said he wouldn't sign it — and he made sure his base knew.

"The president has gotten word to me that he is either getting money for the border, for border security, or he's shutting the whole thing down," conservative host Rush Limbaugh assured his audience.

Of course, like anyone who attended Trump rallies during the 2016 campaign or in the run-up to last month's midterm elections, the president surely understands from personal experience that no issue more galvanizes his supporters than the border barrier, sparking chants of "build the wall!"

But perhaps, with pressure mounting from establishment Republicans in Congress to avoid the specter of failing to govern, he needed a reminder to dance with the base voters who brought him to the White House.

He got it.

"We’ve seen the president pushed around a lot by the swamp," said Michael Caputo, a New York-based Republican strategist who worked on Trump's 2016 campaign. "This is a core campaign promise that crosses all demographics of his base."

And, he added, "a lot of us think of this as a true test of his mettle."

Republicans aren't the only ones to put it in those terms.

After the televised Oval Office meeting with Trump in which he said he would be "proud" to take political ownership of a shutdown, House Minority Leader Nancy Pelosi, D-Calif., said the battle was "like a manhood thing for him — as if manhood could ever be associated with him — this wall thing," according to a Democratic aide who declined to be identified by name.

However the wall fight turns out, Trump's wavering has left room for everyone in his party to be upset with his handling of the matter.

House and Senate Republicans who hoped to avoid a shutdown, with or without including the wall money in a funding bill, had the carpet pulled out from under their feet at the last minute.

And Trump's staunchest allies in the border-security battle, saw him cave again under pressure from the Washington establishment — even if he ended up where they wanted him.

The bottom line for Trump ahead of his shutdown gamble: He's just folded twice — and with the new Democratic majority about to take over, his hand isn't growing any stronger.