President Trump’s potential trade war with China could hammer American farmers. Now Trump is scrambling to find ways to protect them, looking into reviving obscure Depression-era programs and potentially rejoining the free trade agreement he pulled out of during his first week in office.

If Trump ends up actually reentering the Trans-Pacific Partnership, the colossal trade accord he abandoned on January 23, 2017, he would be reneging on one of his signature campaign promises and pulling off one of the most head-spinning policy reversals of his presidency. Trump won the White House on an anti-free trade platform and had spent months arguing that the deal would kill American jobs.

Now he’s searching for a solution to a problem very much of his own making. The president is weighing whether to impose tariffs on up to $150 billion worth of Chinese exports to the US to punish China for its theft of intellectual property from American companies. Beijing has promised to retaliate against the US with its own tariffs — and is homing in on the US agricultural industry.

China has said it will levy 25 percent tariffs on crops like soybeans, corn, and wheat, which are all grown in parts of the country that are home to some of Trump’s strongest political supporters. American soybean farmers are particularly vulnerable — China makes up about 60 percent of their international sales.

The Chinese measures would be a big problem economically for the farmers, and potentially a big problem for Trump and his party heading into this fall’s midterm elections. That has the White House considering whether to dust off the Commodity Credit Corporation, a program created during the Great Depression to aid farmers. The program could be used to buy crops from farmers if they’re hit hard by Chinese tariffs.

It also could help Trump at the negotiating table before China retaliates.

“It’s a way of bolstering his credibility for the negotiations [with China] ahead, and a means to deflect complaints from farm-state senators and congressmen,” said Gary Hufbauer, a senior fellow at the Peterson Institute for International Politics.

Trump could theoretically persuade China that tariffs on American farmers would be pointless since they’re going to be protected by the US government regardless.

So far, at least, there isn’t much enthusiasm for reviving the decades-old program. Rejoining the TPP, meanwhile, would be extremely difficult logistically. Trump wants to shield America’s farmers from the impact of his own policies. It’s not clear that he’ll be able to.

Trump proudly pulled the US out of a mammoth trade deal. Getting back in will be hard.

Trump’s potential reversal on the TPP deal stunned lawmakers from both parties.

On Thursday, the president he told farm-state governors and lawmakers that he was directing his advisers to look into reentering the pact in order to open up more markets for American farmers. It’s a remarkable about-face given his consistently harsh rhetoric about the pact, one of the Obama administration’s major policy achievements. It was designed to eliminate trade barriers between 12 Pacific Rim countries representing 40 percent of global GDP, but Trump called it “one of the worst trade deals” and pledged to withdraw from it upon entering the White House.

The White House said that Trump is open to rejoining the TPP if it can be improved. “The president has consistently said he would be open to a substantially better deal, including in his speech in Davos earlier this year,” White House deputy press secretary Lindsay Walters said in a statement. “To that end, he has asked [US Trade Representative Robert] Lighthizer and [National Economic Council Director Larry] Kudlow to take another look at whether or not a better deal could be negotiated.”

Republican lawmakers supportive of free trade welcomed the news with open arms. “The best thing the United States can do to push back against Chinese cheating now is to lead the other 11 Pacific nations that believe in free trade and the rule of law,” Nebraska Sen. Ben Sasse said in a statement.

if Trump does ultimately try to reenter the TPP, it would be a process that could take months or even years. That’s a problem given that the US and Chinese tariffs could go into effect within weeks. All of which means that Trump is running out of time to find ways to protect American exporters from the full impact of his own protectionist policies.