Donald Trump risks endangering his own legislative goals and his party's support by threatening to "close down our government" in a bid to make sure a spending bill pays for his long-promised border wall, experts warn.

The U.S. president's ultimatum this week, directed at the power brokers within his own party, is a dicey strategy to try to secure $1.6 billion in seed funding for the U.S.-Mexico border wall. If Congress presents a budget that Trump vetoes because it omits money for his wall, it would trigger a politically loathsome shutdown, likely to be blamed on Republicans.

Making good on that threat also risks:

Crippling Trump's already stalled legislative agenda.

Burning Republican leaders he needs to help advance his goals.

Hurting the party's chances of holding its Senate majority in the midterm elections.

And rattling the stock market, an economic gauge Trump depends on to promote his presidency.

A portion of the border fence is shown in Nogales, Ariz. On the campaign trail, Trump promised he'd build a wall along the entire southern border, and that Mexico would pay for it. (Jason Burles/CBC)

Not that any of that seemed to bother Trump during his rally in Phoenix, Ariz., on Tuesday night.

"Believe me," Trump told the crowd. "If we have to close down our government, we're building that wall."

A shutdown forcing federal agencies to send all non-essential employees home is "an inevitability," says Steve Bell, a former Senate budget committee director and now a senior adviser at the Bipartisan Policy Center, a Washington-based think-tank.

"Trump is dead serious. He really wants to motivate his base with the wall," Bell says. "He keeps his base intact and I don't believe he thinks there will be significant political ramifications because his base will be glad they're fighting against this evil Congress."

Hard to back down

Nobody wants a shutdown, Speaker of the House Paul Ryan said. But many mainstream Republican lawmakers likely aren't willing to put taxpayers on the hook for Trump's border deterrent that could cost $15 billion.

Many Trump supporters are concerned about illegal immigration and passionately support the wall, so "it's tricky for the president to back down" after such uncompromising remarks, Bell says.

Trump's wall promise is very important to many of his most passionate supporters. (Reuters)

The Democrats, on the other hand, would love to have a fight with Trump over a government shutdown triggered by his wall, Bell says.

Such a battle, he says, "would appeal to the folks who don't turn out to the midterms, but could, if properly motivated."

Congress returns from recess on Sept. 5. It then has precious little time to pass a spending resolution to keep government agencies running beyond Sept. 30.

A signal of dysfunction for voters

If Trump's strong-arming triggers a shutdown, it could signal to the electorate that there's unprecedented dysfunction in Washington. Never has a shutdown occurred while one party — in this case the Republicans — controlled the House, the Senate and the presidency.

So far, the president has fallen short of achieving any major legislative goals. A shutdown would grind things to a halt, "putting a lot of sand in the legislative gears," Bell says.

After failing to repeal the Affordable Care Act, Republicans must move forward on tax reform and the debt ceiling.

Sen. Jeff Flake of Arizona is one of Trump's recent Republican targets. (Yuri Gripas/Reuters)

And yet, just when Trump needs congressional friends the most, he continues to rip lawmakers from his party, taking pot shots at Sen. Bob Corker ("Tennessee not happy!"), alluding to Arizona's Jeff Flake ("weak on borders") and blaming Ryan in a tweet for the debt ceiling "mess." He also lashed out last week at Arizona senator John McCain, though not by name, as the "one vote" who spoiled Obamacare repeal efforts.

"I think we've gotten to the point now where this particular Congress, as well as leadership, has no particular reason to want to assist in a presidential agenda," says Mark Harkins, a congressional analyst with the Government Affairs Institute at Georgetown University.

Jeopardizing Senate majority

While the Founding Fathers set up the system of co-equal branches of government, Harkins wonders whether Trump's business background could be clouding his judgment about just how powerful a legislator Senate majority leader Mitch McConnell is when it comes to marshalling senators to back his policies.

"It seems as if Trump is treating Congress as a sub-contractor, and he's trying to bully the sub-contractor."

The only problem I have with Mitch McConnell is that, after hearing Repeal & Replace for 7 years, he failed!That should NEVER have happened! —@realDonaldTrump

McConnell, whom Trump blamed for the "disgrace" of the Senate failure to repeal Obamacare, has reportedly not spoken with Trump in weeks. He would likely not take well to a funding impasse over the wall — not after Republicans suffered stinging headlines for the 2013 shutdown. In just one example of the many consequences from that round of furloughs, families of soldiers killed in Afghanistan were temporarily denied death benefits.

Republicans have no desire to trigger a backlash for allowing a repeat under their watch. Although Republicans are expected to retain a majority in the House, owing in part to favourable congressional redistricting, historical trends dictate that an unpopular president's own party usually suffers big midterm losses in the House. (Trump's job-approval ratings fell to 34 per cent in a Gallup tracking poll last week.)

The Senate has a thin 52-48 majority. Above all else, McConnell wants to preserve Republican dominance in the upper chamber.

Attacking Republican incumbents

Which is why Trump attacking Flake and Sen. Dean Heller of Nevada is so "disturbing," says Donald Wolfensberger, director of the Congress Project at the Wilson Center in Washington.

"It's unusual for a president to take on members of Congress in his own party that he would need most to get things done."

Both Flake and Heller drew the ire of Trump for criticizing him or breaking from him on policy. The White House has been reportedly backing challengers to their seats.

That could imperil Republican strength in the Senate, Wolfensberger warns, as "you might end up with a weaker, untested opponent" besting Flake or Heller in a primary, only to "get knocked out" by a Democrat in a general election. Both incumbents' poll numbers look soft and Republicans can ill afford to lose seats.

'Politically damaging'

It's clear the wall is the one priority Trump is willing to go to the mat for, says Trent Duffy, political consultant and former deputy press secretary for President George W. Bush.

Even so, Duffy can't foresee a shutdown happening. He chalks Trump's rhetoric up to "the pre-mating dance" of budget negotiations.

A shutdown would be "politically damaging," he says, "especially to the president, who ran on getting things done."

If markets quiver over fears the debt ceiling won't be extended due to a prolonged funding stalemate, Duffy expects Trump will change his mind.

"He has largely used the markets to gauge his management of the economy," he says. "If markets were to start getting jittery over shutdown threats, I think you would see a quick course correction."

Trump was wrong on the campaign trail to presume Mexico would pay for his wall. If he's wrong on this gambit, he could end up paying a steep political price.