With the Upper House passing the U.S.-Japan trade agreement Wednesday morning, Prime Minister Shinzo Abe achieved one of his most important goals of the current Diet session, and has paved a path for a deal to be ratified on Jan. 1.

In a way, it’s an early Christmas gift from Abe to U.S. President Donald Trump, and the latter could use one: He is besieged by the impeachment inquiry, at a stalemate in trade talks with China and has provoked Brazil, Argentina and France in what could devolve into new trade conflicts.

Some political watchers say the new trade deal, which does not require U.S. congressional authorization, will keep Trump satisfied and let Japan off the hook — the U.S. president prefers bilateral agreements over multilateral pacts and is prone to lashing out at allies, whom he accuses of taking advantage of the U.S.

At the same time, it’s a gamble for Tokyo — and a case study for U.S. allies elsewhere — to see whether concluding a trade deal with the Trump administration is a sufficient insurance policy that discourages him from making further requests in the future.

“This Japan-U.S. trade agreement could serve as the equivalent of a bulwark against additional demands from President Trump,” said Junichi Sugawara, a senior research officer at the Mizuho Research Institute. “Other countries have directly confronted the U.S. head-on and they are in tariff battles. … I don’t know whether he will reverse (the agreement), but the deal could have the effect of removing Japan from his cross hairs for the time being.”

The deal will allow U.S. agricultural goods to be exported to Japan on broadly the same terms as the revised Trans-Pacific Partnership agreement. Trump pulled the U.S. out of the Pacific Rim trade deal within days of assuming the presidency in 2017.

With this deal, tariffs on U.S. beef will be gradually lowered from 38.5 percent to 9 percent. Tariffs on U.S. pork will be cut from ¥482 per kilogram to ¥50 per kilogram. Washington estimates that the deal will open up the market to $7 billion (¥759 billion) worth of agricultural products.

Japan will also not set new quotas for U.S.-produced rice and butter.

In exchange, Tokyo says Washington pledged neither to impose a 25 percent additional tariff on Japanese cars on national security grounds nor an export quota, both of which the Japanese auto industry regards as grievous threats.

Additionally, tariffs on Japanese industrial goods, such as steam turbines, as well as musical instruments and bicycles, will be lowered or eliminated. The countries also established rules on digital trade.

Tokyo is calling the deal a “win-win” for both sides.

The deal was put together in an unusually short time frame. The two sides spent about a year negotiating the agreement and just a few weeks finalizing it — a stage that could easily have taken months.

The two sides have four months from the day of ratification to discuss subjects to be taken up in further rounds of negotiations.

Nevertheless, Japan has reasons to be anxious about the mercurial U.S. president. For example, Trump on Monday took many by surprise when he declared that the U.S. would levy punitive tariffs on steel and aluminum imports from Brazil and Argentina after rebuking them for what he claimed was currency manipulation.

He took aim at France as well, threatening to impose tariffs of up to 100 percent on $2.4 billion worth of goods, claiming that the country’s new digital services tax would harm U.S. tech companies.”(Trump) is not someone who understands lending and borrowing,” said Kazuhito Yamashita, a research fellow with expertise in agriculture and trade policy at the Canon Institute for Global Studies. “Everyone knows he’s not someone easy to please.”

Abe sought to build a close relationship with Trump shortly after he won the 2016 presidential election —calling Trump by his first name and even organizing a state visit earlier this year. Since the election, the prime minister during that time has aggressively worked to ease Trump’s dissatisfaction with the two nations’ trade imbalance.

A test of how effective the trade deal is in taming Trump will take place next year when Tokyo begins negotiations with Washington on cost-sharing in regards to maintaining U.S. military forces in Japan. Trump reportedly urged an eye-popping fivefold increase in South Korea’s contribution for troops stationed there, rattling Japanese defense officials.

Trump on Tuesday revealed he has raised the subject of an increase with Abe.

“I said to Prime Minister Abe, a friend of mine, Shinzo. I said, ‘You have to help us out here. We’re paying a lot of money. You’re a wealthy nation. And we’re, you know, paying for your military essentially,”‘ he said in London.

Still, Japan could win by feigning defeat, and if no outrageous demands materialize from the U.S. side, Tokyo would claim that is because of the trade agreement, said Mieko Nakabayashi, a professor specializing in American politics at Waseda University.

“A way of thinking (about this) is winning by losing,” she said. “Within the framework of trade, it’s obvious that Japan lost and the U.S. won,” she said. “But if you expand that framework by including diplomacy and national security as factors to take into consideration, I’d say Japan did a decent job. … But we have to see.”

For Trump, he will surely use the deal as ammunition to boost his bid to serve a second term in office, particularly with farmers, a block of voters indispensable for his re-election next year. U.S. farmers have taken a big hit recently due to the U.S.-China trade war.

Trump’s objective was to put American farmers on a level playing field with those from TPP members, said Yamashita, and since the U.S. fulfilled that goal, it is possible that the Trump administration may not be interested in reaching a more comprehensive deal.

Yamashita also argued the trade deal’s ultimate goal is to appease Trump, despite Japan having an upper hand in the negotiations. By ratifying the bilateral deal, he believes Japan has lost the leverage needed to incentivize the U.S. to rejoin TPP.

The 2.5 percent auto tariffs on Japanese cars, which the U.S. agreed to phase out in TPP before Trump withdrew, will be kept in the deal.

“I think Japan was aware of the necessity of striking a deal that aligns with (Trump’s) thinking, knowing a single decision could cause a massive blow to the Japanese economy,” said Sugawara of the Mizuho Research Institute.