Open this photo in gallery Prime Minister Justin Trudeau arrives at his office for NAFTA talks September 30, 2018 in Ottawa. Dave Chan/The Globe and Mail

No deal is better than a bad deal, Justin Trudeau often said. But when a mediocre deal comes along, you try to grab it and run.

That’s what happened as NAFTA talks went down to the wire this weekend. Mr. Trudeau wasn’t as immune to deadline pressure as his ministers claimed last week. Canada was making concessions. But, judging by the outlines of the deal hammered out Sunday night, it avoided the most damaging ones.

The North American free-trade agreement was re-opened and was being stitched back up without major damage to the Canadian economy. If the emerging details bear that out, Mr. Trudeau will count that as a win. The threat of a disastrous North American trade war will be over.

Story continues below advertisement

The peace treaty worked out on Sunday isn’t going to be a glowing ode to the principles of free trade. When Mexico agreed in August to caps on the growth of its auto exports to avoid the threat of steep tariffs, Canadians moaned that it was managed trade, not free trade. By this weekend, officials were asking auto-sector representatives what kind of quotas they could live with.

That’s a concession, but it probably won’t make a deep dent in Canada’s economy. Dan Ujczo, a trade lawyer with Dickinson Wright in Ohio, said it’s a “philosophical concession,” because the quotas are not likely to be a major curb on Canadian auto exports. If accepting quotas protects Canada from 25-per-cent tariffs on autos that could devastate the industry, and Canada’s economy, it’s buying some security.

Just a week ago, though, Mr. Trudeau’s ministers were talking like they’d take their chances. The U.S. set an Oct. 1 deadline, and had already cut a deal with Mexico, but Canadian government figures suggested the deadline wasn’t their concern.

But the deadline got real. The Trump administration wanted that Mexico deal signed by President Enrique Pena Nieto before he leaves office Dec. 1 – and the U.S. had to publish a text 60 days before it’s signed. Last week, members of Congress balked at the prospect of a Mexico-only deal, which increased the Trump administration’s desire to get Canada into a trilateral deal by the Sunday night deadline.

Mr. Trump’s administration renewed its tariff threats and showed some willingness to compromise, notably on a new version of the dispute-settlement mechanism that Mr. Trudeau declared essential.

The most high-profile Canadian concession, conceding a piece of the protected dairy market to U.S. imports, might cost Mr. Trudeau politically with well-organized farmers – but he was able to put it off until Quebec’s political leaders had little time to make it a major issue in Monday’s provincial election.

And for the economy, that dairy concession isn’t a major hit. Business leaders had privately urged negotiators to seal a deal with a dairy concession. Mr. Trump routinely makes Canada’s 300-per-cent dairy tariffs a rhetorical target at his rallies – some kind of concession on dairy was always going to be the price of a deal.

Story continues below advertisement

There will be a series of other concessions when the ink dries. Negotiators would have judged this a poor deal in the past. But the old poor deal is the new cause for relief. Right now, it is shelter.

That is, it is shelter if the details provide reliable assurances that Canada will be spared from tariffs that the Trump administration threatened to impose on autos invoking spurious national-security grounds.

The deal being done Sunday doesn’t have so-called poison-pill demands that the U.S. made last October. Thanks to Mexico, it doesn’t have a sunset clause that requires it to be renegotiated after five years. It still has a dispute-resolution mechanism to replace Chapter 19, and the Liberals will say that only came after they held out to the 11th hour – though the fine print will be scoured to see what compromises were made.

Could Mr. Trudeau have done better if the Canadian team hadn’t been pushed aside when the U.S. and Mexico started to hammer out the framework of an agreement in summer? It’s hard to know. But on first blush, it appears Mr. Trudeau’s critics won’t have big, damaging cave-ins to point to – but rather a series of concessions that the Liberal government accepted to buy peace. It’s not the “win-win-win” deal Foreign Affairs Minister Chrystia Freeland kept talking about during negotiations. Mr. Trudeau will take it.