Canada and the US agree on revisions to the North American Free Trade Agreement, after more than a year of protracted negotiations and hours before an imposed deadline.

The deal was announced late Sunday, almost five weeks after the US completed a deal with Mexico and Donald Trump threatened to break up NAFTA by leaving Canada to the side.

In a joint statement, US Trade Representative Robert Lighthizer and Canadian Foreign Affairs Minister Chrystia Freeland said the agreement:

[This] will result in freer markets, fairer trade and robust economic growth in our region.

It will strengthen the middle class, and create good, well-paying jobs and new opportunities for the nearly half billion people who call North America home.

Washington wanted to ensure a revised accord before Mexican President Enrique Peña Nieto leaves office on December 1. Under that timetable, the text of the agreement had to be submitted to Congress before October.

Even before Trump’s August warning, Administration officials had targeted Ottawa with threats and insults. After the G8 summit in Canada in June, they said a “special section of hell” was reserved for Prime Minister Justin Trudeau because he said Canadians would not bow to US pressure.

A Canadian Win?

Under the last-minute deal, Canada will allow US farmers greater access to its dairy market but will still maintain its system of support for local producers. A Canadian official said the revised provision mirrors Canada’s agreements and the European Union and with Pacific countries.

In a major victory for Ottawa, Trump’s threat to lower Canadian auto exports has been reversed: the threshold for any tariffs has been rasised to 2.6 million Canadian cars from the current 1.8 million.

Ottawa was also to prevent the removal of Chapter 19, which limits the ability of the Americans to impose unilateral tariffs. There were no major changes to its protection of intellectual property for cultural products such as movies, books, and broadcasts, although copyright terms were extended from the life of the author plus 50 additional years to life plus 70 years. Canada also agreed to extend certain protections for pharmaceutical patent data from 8 years to 10 years, a change opposed by manufacturers of generic drugs.

For political presentation in the US — and possibly because of Trump’s hatred for NAFTA as “the worst deal maybe ever signed” — the accord has been renamed USMCA — the United States-Mexico-Canada Agreement.

Both sides hailed the revision.

“It’s a good day for Canada,” Trudeau said as he left a late-night Cabinet meeting. He repeated on Twitter:

Trump did not react but a “senior Trump Administration official” said, “It’s a great win for the President and a validation of his strategy in the area of international trade…[with a] host of provisions that will rebalance our trade relationship with Mexico and Canada.”

Issues of dispute still remain. Officials said the revision does nothing about Trump’s steel and aluminum tariffs imposed in May on Canada, as well as other allies like the European Union, or on Canada’a retaliatory tariffs on US products.

The Trump Administration official said the deal includes a “review and termination provision”, but did not make clear what this means — the Administration had pushed for an auto-termination “sunset clause” which was opposed by Trudeau.