OTTAWA — Canadians appeared to breathe a collective sigh of relief Monday at the signing of a new North American trade deal — not because it was a win, exactly, experts said, but because the result could have been much worse.

Negotiations to rework the North American Free Trade Agreement, or NAFTA — which President Trump has repeatedly called the “worst trade deal ever” — lasted more than a year, and in the end Canada made a few major concessions.

The United States-Mexico-Canada Agreement, or USMCA, partially opens up Canada’s long-restricted milk market to American farmers and gives U.S. drug companies two more years of “market protection” from generic competition in Canada. U.S. tariffs on Canadian steel and aluminum remain in place.

But in agreeing to the terms of the new deal, Canada avoided doomsday scenarios that had been hanging over the country for months, particularly Trump’s threat of punitive tariffs on auto imports that would have caused major economic fallout. Canada also successfully pushed to keep a special dispute process, called Chapter 19, intact.

The Canadian sectors most affected by the deal, particularly dairy producers, criticized the government Monday. But even that disapproval was relatively muted. Pundits had speculated that the timing of the deal could be disastrous in Quebec, a politically key province hurt by the new dairy provisions. The province held its election on Monday, less than 24 hours after the deal was released.

But trade news looked unlikely to affect people’s votes, said Pierre Martin, a political scientist at the University of Montreal.

“There’s really no time to make it count, politically, for today’s election,” he said.

The new U.S.-Canada dairy rules echo what Canada had already offered under the Trans-Pacific Partnership, Martin said.

In a news conference, Prime Minister Justin Trudeau said that dairy producers will be compensated for their losses, though he offered few details. He said he was pleased with the deal, given the circumstances and despite moments of “pessimism” along the way.

“When we began the work of updating NAFTA, we kept our focus to what really matters,” he said.

Canada is “in a much more stable place than it was yesterday,” he later added.

Even Trudeau’s habitual critics were divided, with many political opponents pointing out remaining concerns — especially the steel and aluminum tariffs — but others congratulating the government.

“A NAFTA deal in principle will help ease investor anxiety, stabilize trade exposed sectors and reassure the world that North America remains committed to free trade,” tweeted Rona Ambrose, who served until last year as interim Conservative leader before retiring from politics.

The deal did give an immediate boost to the Canadian economy after months of uncertainty, with the Canadian dollar rising to its highest level since early this year. It’s certain now that the Bank of Canada will raise interest rates at its next meeting, a move that had been delayed, said David Baskin, the president of Baskin Wealth Management in Toronto.

But the biggest relief was knowing the auto tariffs suggested by Trump wouldn’t materialize, said Baskin.

“It removes a huge uncertainty, particularly about the auto industry, which was the big threat hanging over the Canadian economy,” he said.

There are bigger lessons from the new agreement, said Baskin. For one, he said, Canada must turn its attention to diversifying trade to become less reliant on the United States.

“You’re dealing with the thousand-pound gorilla,” he said. “The fact is that the American economy is 10 times bigger than the Canadian economy. The U.S. can damage Canada without hurting themselves very badly.”

Trudeau is up for reelection next year, and voters may look back on the year-long trade negotiations approvingly. But Baskin said that some, like him, think the situation was mishandled from the start, despite their relief on Monday.

Still, “I think he played a weak hand moderately well,” he said.

The president of the Canadian Chamber of Commerce, Perrin Beatty, congratulated the Canadian negotiators in a statement “for delivering an agreement . . . and for doing so under extraordinarily challenging conditions.”

Accepting some losses seemed inevitable with a bargaining partner who saw the two countries’ interests in opposition, said Cyndee Todgham Cherniak, a Toronto-based trade lawyer.

“This is a situation where President Trump took away some of the concessions that were granted under the original NAFTA,” she said.

“So it’s about U.S. farmers winning and Canadian farmers losing. U.S. pharmaceutical winning and Canadian pharmaceutical losing. U.S. steel companies winning, Canadian steel companies losing.”