After four years of grueling negotiations, the EU's landmark trade deal with Japan boiled down to one intractable issue: soft cheese.

In an ornate room buried deep in Japan's foreign ministry on the night of July 1, Phil Hogan, European commissioner for agriculture, saw time slipping away. His flight to Rome, where he was scheduled to attend a meeting of African agriculture ministers, was just hours from departure.

The world's biggest trade deal was tantalizingly close but the Japanese were refusing to budge on dairy products, seeking to protect delicacies such as Sakura cheese from the island of Hokkaido, a creamy speciality flavored with cherry leaves. This was a potentially fatal hurdle. At its core, the deal needed Tokyo to open up its agricultural markets in return for Europe dropping tariffs on Japanese cars.

Higher up the political food chain, national leaders were clamoring for a free-trade deal as a counter-blast to U.S. President Donald Trump's increasing protectionism, but that didn't make the minutiae of a deal on dairy goods any easier in the diplomatic poker game being played out in Tokyo.

Yuji Yamamoto, Japan's agriculture minister, had little room for maneuver because he was under heavy pressure from the powerful Central Union of Agricultural Cooperatives. On the EU side, the 6-foot-5-inch Irishman from Kilkenny was playing hardball, pushing for a yearly quota with reduced tariffs for 40,000 tons for European cheeses such as Camembert and Brie.

“Hogan’s role should not be underestimated. His level of stamina was truly immense” — Senior European diplomat

According to several EU officials at the talks, Yamamoto was almost tearful and pleaded with Hogan to back off. The European commissioner had built up a close rapport with his Japanese counterpart, who also happened to be chairman of the Japan-Ireland Parliamentary Friendship League. Softening his approach, Hogan consoled him, saying that he too was from a farming nation and understood the corner he was in.

After a huddle with close aides, Hogan played his gambit: Europe would reduce its market access demand for soft cheese to 31,000 tons in exchange for almost complete market access for hard cheeses such as Cheddar, skimmed milk and whey, which is used in the fast-growing protein shake market.

Yamamoto agreed. In that peculiar moment of lactic harmony, a political agreement was essentially done.

Five days later in Brussels, EU leaders and Japanese Prime Minister Shinzō Abe were able to announce their accord.

Marathon man

“Hogan’s role should not be underestimated,” said one senior European diplomat briefed on the talks in Tokyo. “His level of stamina was truly immense.”

It was a big European-level coup for a man who had left Irish politics under a cloud. Hogan was renowned as a tough back-room fixer in Ireland, but he burned much of his political capital through the introduction of water charges as part of Dublin's bailout program during the financial crisis. The massively unpopular measure — water use had been free for decades — triggered some of the biggest protests in Irish history.

The Tokyo trip was a bruising weekend getaway for Hogan. He had arrived at 4 p.m. on Friday, June 30 and opened negotiations at 6 p.m. after a few moments to freshen up in his hotel. The talks then turned into a war of attrition, divided over seven rounds. On the first night, he returned to his hotel room shortly after midnight, before kicking off again at 8 a.m.

On Saturday, talks ground on for 12 hours and those involved grumbled there was no food. They had to revive themselves with bottles of sparkling Perrier water that they scavenged from a foreign ministry kitchenette.

The final compromise was secured at 8:30 p.m. on Saturday in a four-way meeting with Hogan, Yamamoto, European Commissioner for Trade Cecilia Malmström and Japanese Foreign Minister Fumio Kishida.

It had gone down to the wire, and the EU commissioners finally had 17 minutes for their dinner before rushing to the airport.

A sudden change in the wind

The 11th hour mission to Tokyo by Malmström and Hogan was the last big heave in negotiations that often seemed close to failure over recent years, primarily because Japan's politicians were unable to make concessions on agriculture. In part, Tokyo feared that EU farm exports would wipe out fragile rural communities inhabited predominantly by elderly farmers. But EU negotiators also complained Japan was intransigent over products such as tomatoes, chocolate and pasta, where it has no real defensive interests.

Talks had become so bogged down and embittered by the end of 2015 that Mauro Petriccione, the EU's chief negotiator, warned that Brussels could face a terminal credibility crisis if negotiations dragged on much longer without a breakthrough.

Negotiations limped on through 2016 until U.S. President Donald Trump's election in November suddenly forged an entirely new political dynamic. In January, the protectionist president pulled the U.S. out of the Trans-Pacific Partnership with Japan and 10 other Pacific Rim countries. In an instant, the game had changed.

Trump's rejection of the TPP was a devastating blow to Tokyo, which had long seen the U.S. as the cornerstone of its foreign policy and the guarantor of its security in the face of Chinese naval expansion and North Korean missile launches. For weeks, Japanese officials were in denial and still held out hope that the TPP might survive.

In February, Japanese Prime Minister Abe made a last-ditch attempt to cozy up to Trump by going off to play golf with him at his Mar-a-Lago resort in Florida. Shortly afterward, the Japanese realized it was time to switch horses and make a big push for a European deal. Free trade is a key pillar of the prime minister's policy of "Abenomics" to jolt the economy out of decades of cryogenic stasis, and it became clear that the EU was now the most obvious partner.

“Sometimes I felt that we could never conclude this one, but sometimes the wind comes from another way and suddenly accelerates [talks],” said Japan's foreign ministry spokesman, Norio Maruyama, after the deal was agreed at a political level on Thursday.

In March, Abe visited European Commission President Jean-Claude Juncker to try to breathe new life into the EU talks. Diplomats say the process was dramatically catalyzed by the intervention of German Chancellor Angela Merkel, who made it clear she wanted a deal before the G20 meeting in Hamburg in July, where she could parade the Brussels-Tokyo pact as a direct rebuke to Trump's protectionism.

Into the endgame

In mid-June, the chief EU negotiator Petriccione headed to Tokyo for what was seen as the decisive endgame phase. One person closely involved with the talks joked that the Italian had bought a "one-way ticket." Malmström said she had told the former coast guard officer “to not come home until it’s done.”

Petriccione is one of the Commission's most successful negotiators, who sealed Brussels' deals with Canada and Vietnam. Under his supervision, a practical framework for a deal emerged. Europe would drop its 10 percent tariff on cars over seven years and cut duties on motor components more swiftly.

In return, the EU clawed out increasingly preferential agricultural terms. Farmers have welcomed the pact with Tokyo with unalloyed enthusiasm.

European beef producers will now be able to send 50,500 tons of meat annually to Japan and tariffs on beef will also be cut from 38.5 percent to 9 percent over 15 years. Japan's initial offer had been a measly 3,000 tons.

Duties on pork, the EU's biggest export to Japan, will be phased out over 10 years. Duties on wine, the second most important export, will be removed as soon as the deal comes into force. Juncker has predicted that will be in 2019.

One senior European trade diplomat observed that Brussels had an unusual stroke of good fortune in being able to win such advantageous terms. Japan had already worked out how much it had been willing to concede to the U.S. under TPP and shifted those same terms over to the EU.

In another win that was largely considered impossible at the end of 2015, Petriccione's team also won Japan's consent to open up its train sector to foreign competitors such as France's Alstom and Germany's Siemens.

Last tango in Tokyo

Despite Petriccione's progress, however, it was clear by late June that a final big political offensive and display of political will was needed to wrestle the deal over the line. Malmström and Hogan landed in Tokyo on June 30.

The Irishman was, in some respects, an unlikely savior. He has a formidable reputation as a strongarm enforcer from Irish politics but, in trade circles, he is largely seen as a hinderance to deals. He has been particularly effective in undermining EU agreements with the Americas, which he identifies as a threat to core European farming interests such as beef.

U.S. trade officials found Hogan to be a pugnacious adversary and felt that his force of personality often drowned out the more diplomatic, consensus-driven approach of Malmström. During discussions over a now shelved transatlantic trade deal, he notoriously rebuffed what he saw as a risible American offer by spitting back: "We're not fucking Burundi!"

"Lots of separate little parts have to work together and fall into place, but when they start to assemble it’s something quite beautiful" — Cecilia Malmström on the trade deal

Observers noted that he took a far less abrasive approach with the Japanese, keenly aware that all parties needed to preserve "face."

While Hogan crunched out a deal on dairy in Tokyo, Malmström held bilateral talks with Foreign Minister Kishida and Economy Minister Hiroshige Sekō.

By the time the two EU commissioners flew back, only fine print remained unresolved. Malmström sounded almost giddy with the progress made in the Japanese capital. "As always in trade negotiations it’s a moving target, lots of separate little parts have to work together and fall into place, but when they start to assemble it’s something quite beautiful,” she said.

Malmström secured the final political agreement in Brussels on Wednesday after discussions with Kishida. With cars never far from the top of the EU-Japan agenda as the big tradeoff for the agricultural concessions, the final discussions before the cheery handshakes focused on pumps and compressors for the auto industry.

The next day, Prime Minister Abe was all smiles as he posed for the cameras with Juncker and EU Council President Donald Tusk.

He conceded the talks had dragged on until the "11th hour" but insisted that the long night's tussles over cheese had ultimately yielded an agreement that would be "a model for the 21st century order."