WASHINGTON — President Donald Trump is losing badly on immigration.

Neither Mexico nor Congress is willing to pay for his promised border wall. His proposal to rewrite laws to limit illegal and legal immigration has so far failed to gain traction on Capitol Hill. And after a drop in apprehensions at the southern border in fiscal 2017, there was an increase of 25 percent in fiscal 2018.

On the political front, Trump made immigration the centerpiece of his case to voters in the November midterms — and watched Democrats win their biggest House victory since the post-Watergate class of 1974. Of the Republicans who held onto their seats, Rep. Will Hurd is the only one who represents a district along the southern U.S. border, and he opposes the wall.

Now his government, with Republicans still in control of the White House and both chambers of Congress, is on the verge of a partial shutdown over his insistence that a year-end spending bill include $5 billion for a border wall that lacks sufficient support within his own party.

None of this has escaped the notice of Trump's friends and foes in the raging debate over an issue he put at the forefront of his political identity from the moment he launched his presidential campaign in 2015.

"Instead of winning, we’re getting whining," conservative commentator Ann Coulter wrote last month in a column excoriating Trump for what she predicted would be his capitulation in funding the government without getting money for the wall. "Without a wall, he will only be remembered as a small cartoon figure who briefly inflamed and amused the rabble."

Even as his prospects of winning keep thinning — Democrats will take control of the House in January — Trump keeps throwing chips on the table. Now, he's staked his policy legacy, his own political fortunes and those of fellow Republicans, and the continuing operations of several government agencies on getting a $5 billion jump on building the wall.

It's the Atlantic City equivalent of raiding an ATM to recoup a night's worth of losses with a single spin of a roulette wheel.

Rachel Bovard, policy director at the Conservative Partnership Institute and a former Capitol Hill aide, said Republicans in Congress bear the blame for stalling Trump's immigration proposals.

"President Trump and the Department of Justice have taken every opportunity to enforce our immigration laws — something the last administration did not prioritize," she said. "But rather than helping him in that mission, Republicans in Congress have joined a bipartisan coalition dedicated to passing amnesty, rather than standing for the strong border policies they claim to support every election year. Republicans in Congress have actively blocked funding for Trump's wall, and failed to enact any substantive changes in border enforcement or legal immigration reform despite repeated requests by the administration."

That's the point Rep. Nancy Pelosi, D-Calif., who is expected to become speaker of the House in January, made to Trump's face during a heated exchange over the possible government shutdown and border-wall funding in the Oval Office last week.

"There are no votes in the House, a majority of votes, for a wall," Pelosi said.

"If I needed the votes for the wall in the House, I would have them — in one session, it would be done," Trump countered.

"Well, then go do it," Pelosi shot back. "Go do it."

During that meeting, Trump said he was willing to shut down the government to try to force Democrats to give him money for the border wall, a position top White House policy adviser Stephen Miller reiterated in an interview on CBS over the weekend.

"We're going to do whatever is necessary to build the border wall to stop this ongoing crisis of illegal immigration," Miller said, adding that Trump is "absolutely" prepared to shutter parts of the federal government on Friday if he can't get a spending bill from Congress that includes the wall money.

At nearly every turn, Trump has taken a hard-line position not only on the broad strokes of his immigration policy but on the specifics of building the wall that his supporters chant for at every political rally he attends.

It's possible that he could have gotten more of what he wanted in terms of border security and immigration policy — not to mention at the ballot box in the midterms — if he'd taken a more conciliatory approach.

David Jolly, a former Republican congressman from Florida, said Trump might have more success if he abandoned his insistence on the wall in favor of demanding that he be given the resources he believes are needed to maintain operational control of the border.

Jolly, who hosts a daily radio show in the Tampa area, said Trump voters want the wall but that he might not lose much of his base if he could make a convincing case that border security could be achieved without it.

"His fatal misstep was in his simplicity of saying he'd build a wall," Jolly said in a text message. "Had he banged the drum on zero tolerance, operational control of the border, sophisticated counter measures, swift adjudication and removal of those without proper claims, etc., he could have had a better political and policy outcome because he could both achieve and declare success."

But Stuart Stevens, a veteran Republican strategist who advised Mitt Romney's presidential campaign, said the mistake is in assuming that Trump is pursuing a goal in linear fashion.

"There is this understandable urge to ascribe strategy or logic to Trump’s actions," Stevens said. "There is none. Trump's mind is like an old fashioned pinball machine on tilt. One day he is proudly proclaiming he wants to own a government shutdown. The next he has a video saying Democrats shouldn’t shut down the government."

Stevens added, "there is no strategy or plan or policy goal."

There was a time when Democrats offered to give Trump $25 billion for the border wall in exchange for permanently extending the Deferred Action on Childhood Arrivals program to provide deportation protection for certain undocumented immigrants who came to the country as children.

If he'd taken the deal, he'd have walked away from the table a winner.

Ever since, he's been doubling down — and losing. But there's no sign yet that he's ready to change his game.