It had long seemed as though Republicans waved the white flag on tariffs, letting President Trump remake their free-trade party in his more protectionist image. But the reaction of several top GOP lawmakers to Trump’s latest tariff threat suggests they may have some fight left.

But it could require them to rebuke Trump on the issue of immigration, as well as trade.

Last week, Trump threatened to impose a 5 percent tariff on all Mexican goods and then increase the levies each month unless the country completely stemmed the flow of migrants crossing into the United States. Initially, GOP leaders seemed opposed on principle but resigned to the idea that there wasn’t much they could do.

Over the weekend, though, attitudes shifted.

By Monday, as Trump warned from London that it would be “foolish” to override him, some Republican senators were discussing a vote to block Trump’s tariffs on all Mexican goods and said they may have a veto-proof majority to do so. It would be their most significant opposition to anything Trump has done to date.

The only other time Republicans have mustered a veto-proof majority against Trump was to force him to sign sanctions against Russia, Iran and North Korea a few months into his administration.

What led to the sudden shift?

A couple of things. It seems as if some adamantly free-trade Republican senators may have decided enough is enough with decidedly anti-free-trade tariffs. Others, such as Sen. Kevin Cramer (R-N.D.), represent agricultural states that could be hit hard by the Mexican tariffs.

And some senators figure that raising prices on all Mexican goods would gut-punch the economy in a way the other, more isolated global tariffs on aluminum and steel and soybeans and other more industrial/agricultural products haven’t. Even the Federal Reserve is stepping in, saying Tuesday that it would do whatever it takes to help the U.S. economy if these tariffs go into effect.

This doesn’t mean Trump will be rebuked, though.

A GOP Senate aide close to trade negotiations told The Fix on Tuesday that there’s no serious movement toward such a vote. It would require important players such as Senate Majority Leader Mitch McConnell (R-Ky.), up for reelection next year in a pro-Trump state, to confront the president in a decisive way. Plus, there’s a case to be made that standing up to Trump on these tariffs is bad politics for the whole party. “Arguing for a free-trade position is very classic Republican … very Bush,” this aide said. “And this isn’t the party of Bush anymore.”

Speaking to reporters Tuesday, McConnell refused to answer what the Senate would do if tariffs against Mexican products kicked in June 10, as Trump has planned. Mexican officials are in the United States right now trying to negotiate something, and McConnell made clear that Senate Republicans are cheering the Mexicans on. “Our hope is that the tariffs will be avoided and we will not have to answer any hypotheticals,” McConnell said.

Still, even talk of such a vote is significant. And there’s still the possibility that if negotiations with Mexican and U.S. officials fail this week, the Senate would act.

According to The Post’s Erica Werner, Seung Min Kim and Damian Paletta, the White House thinks it can institute these tariffs without any congressional input because Trump already declared a national emergency at the border to build his border wall. Republicans opposed that declaration on the principle that Trump was going around Congress. So they passed a resolution of disapproval to try to override it. But the resolution was symbolic because they didn’t have a veto-proof majority to stop Trump.

They could try to pass that resolution again, the thinking goes, this time with a veto-proof majority. The Post’s congressional team reports that some senators think they have that majority.

That’s risky, though. This would directly undermine Trump on his top 2020 issue: immigration. Passing such a resolution would stop Trump from being able to fund the border wall. Even if Republicans don’t agree with how he’s trying to fund the wall, supporting the wall itself remains a fundamental pillar of being a Republican in the era of Trump.

It could be tough for them to go home and explain to Trump supporters why they stopped one of the president’s top policy objectives over a more esoteric trade policy issue.

Trump is also tying these Mexican tariffs to the migrant crisis at the border. As migrants illegally enter the United States at record levels, Trump has cast them as dangerous and ill-willed, and he’s using the threat of tariffs to force Mexico to somehow stem them.

So in opposing Trump, Republican senators risk being seen as anti-border-wall and against acting tough on migrants. It’s a politically risky move, but one that a chunk of Republican senators seem willing to make.