President Trump speaks to journalists on the South Lawn of the White House on Thursday. (Sarah Silbiger/For The Washington Post)

THE MASSIVE influx of Central American migrants across the U.S.-Mexico border is a real problem, to which President Trump’s sudden threat of escalating tariffs against Mexico is a bizarre and wildly inappropriate response. Not only does it attribute, spuriously, all the blame for the migrant flow to Mexico, but it also takes that friendly country’s economy hostage — unless and until “the illegal migration crisis is alleviated through effective actions taken by Mexico, to be determined in our sole discretion and judgment,” as the president put it in a statement Thursday night. U.S. consumers and companies will suffer potentially major collateral damage, all for the sake of a dispute that has nothing to do with trade.

Mr. Trump undermines goodwill he had recently reestablished with Mexico by lifting steel and aluminum tariffs; this was done to promote ratification of the new U.S.-Mexico-Canada trade agreement by Mexico and Canada. Now the treaty’s prospects for passage will again plummet, both in Mexico City and in Congress. Mr. Trump has just shown — again — why it is so hard for any counterpart, domestic or international, to work with him.

If Mr. Trump actually carries out the ultimatum by his self-imposed June 10 deadline, the American consumer will pay to the tune of a few hundred million dollars at first, and $3 billion if Mexico hasn’t satisfied him by October, thus triggering maximum tariffs of 25 percent. And that is for fresh produce alone; projected over the 2018 total of imports from Mexico of $372 billion, including the vast automotive supply chain, the maximum cost could be $93 billion. Mr. Trump is not thinking in cost-benefit terms but rather casts the “lawless chaos” and “mass incursion” as “an emergency and extraordinary threat to the national security and economy of the United States.”

The latter phrasing is necessary to trigger the International Emergency Economic Powers Act, a law that has empowered presidents to act against adversaries such as Iran — and which Mr. Trump now stretches to threaten economic sanctions against our second-largest trading partner. He has apparently done so without the congressional consultation the statute calls for “in every possible instance.”

A tax increase imposed by sudden executive fiat, in pursuit of an irrational conflict with a neighbor and close ally, counterproductive for the White House’s own declared priorities — this epitomizes the kind of erratic presidential rule the Constitution intended to prevent. We are experiencing the downside of past legislation delegating “emergency” international economic power to the executive branch; Congress must, on a bipartisan basis, take it back.

That is a long-term project. In the near term, it’s up to more level-headed parties to try to thwart Mr. Trump. To his credit, Mexican President Andrés Manuel López Obrador has responded with relative restraint, refusing to capitulate but also dispatching diplomats to Washington. The Republican chairman of the Senate Finance Committee, Charles E. Grassley of Iowa, called Mr. Trump’s threat “a misuse of presidential tariff authority” and urged him to pursue alternatives. That’s a start, but reining in this latest fit of presidential pique may take more principled resistance from Republican lawmakers than they have previously shown.