President Trump’s announcement on Thursday that he will likely declare a national emergency to get the money to build his wall along the U.S.-Mexico border is a huge gamble. It will surely delight his base, but risks reinforcing negative views of him among the voters he needs to win reelection.

Immigration control and the border wall are clearly crucial interests to millions of Republicans. Those people will also probably be delighted that the president will act to push their views forward even if it stands on dubious legal ground. According to the 2017 American Values Survey conducted by the Public Religion Research Institute (PRRI), 55 percent of Republicans agree that “we need a leader who is willing to break some rules if that is what is needed to set things right.” That total rises to 66 percent among Republicans who have always backed Trump.

The trouble is that group is nowhere near large enough to deliver the 2020 election to Trump. Republicans who don’t like the president tend to disagree with him — particularly on immigration and the wall — and it was these people whose defection gave Democrats control of the House. Doubling down on the wall is not the way to get these people to give you another chance.

Presidential defenders will be quick to note that any emergency declaration is no more of an improper act that President Barack Obama’s executive order instituting his Deferred Action for Childhood Arrivals program, protecting those young immigrants living in the United States illegally who were brought to this country as children. Without any text to evaluate, it is impossible to say now whether that is true, but Trump’s announcement is politically similar. Both presidents turned to their own pen to break a legislative stalemate over immigration. That similarity is all Trump’s backers will need to justify their man’s acts in their own minds.

Trump’s actions can be challenged in Congress, the courts, or both, depending on exactly what he does. He might be banking that a court injunction will prevent the order from taking effect, thereby giving him a strong act to show his supporters and someone else to blame for the failure to get the wall built. Receiving political credit for ending the shutdown while simultaneously keeping faith with his base would be a political Houdini act of the highest order. If that happens, then Trump just might be able to have his cake and eat it, too.

But if he can’t pull this off, this move could stop his polling rise in its tracks. You can’t claim to want bipartisan negotiation if you act alone — and on dubious legal authority — if you don’t like the best deal you can get. You can’t persuade people that you want to govern on behalf of all people if you contemptuously disregard the elected representatives that half the country put into office.

The president probably figures that this gamble will pay off since he has outperformed virtually every person’s expectations for years. But as Kenny Rogers’ gambler said, “you never count your money while you’re sitting at the table.” The dealing and the game goes on through November 2020, and if that battle is fought over the emergency order and the wall, Trump’s pair of treys aren’t likely to win the pot.

Read more:

The Post’s View: Trump’s presidency enters a new imperial phase — and Mitch McConnell just rolls over

Eugene Robinson: We have a national emergency, all right. Its name is Donald Trump.

Ted Cruz: Make ‘El Chapo’ pay for the border wall

E.J. Dionne Jr.: Trump’s fixation on a wall looks juvenile. Democrats should learn from his mistakes.