WASHINGTON -- From deep within the pantheon of diplomacy that is the United Nations came hardly a warning shot or a red flag -- it was a rocket-propelled rhetorical grenade aimed directly at Canada, with a concussive blast that reverberated all the way to the Prime Minister's Office.

And it just might have been the catalyst for the new U.S.-Mexico-Canada Agreement.

"We're thinking about just taxing cars coming in from Canada. That's the motherlode, that's the big one," U.S. President Donald Trump said last week during his explosive news conference on the margins of the UN General Assembly in New York.

"We're very unhappy with the negotiations and the negotiating style of Canada. We don't like their representative very much."

That "representative" was Foreign Affairs Minister Chrystia Freeland -- the senior cabinet minister leading Canada's trade delegation to rescue NAFTA from a president who won the White House in part by denouncing the agreement as one of the worst deals ever made.

It wasn't Freeland's hard-driving negotiating style that was under Trump's skin. It was her appearance on a panel in Toronto two weeks earlier dubbed "Taking on the Tyrant" that featured a video montage with Trump alongside autocrats like Syria's Bashar al-Assad and Chinese President Xi Jinping.

Trump learned of it only the day before, said a source close to the talks who was briefed by insiders on both sides of the Canada-U.S. border.

"Somehow it got back to the president," said the source, who spoke on condition of anonymity in order to speak freely about the details. "At that point, we saw everything that happened on Wednesday."

That morning, before Trump's news conference, U.S. Ambassador David MacNaughton spoke at an event in Toronto with U.S.-based website Politico, where on a scale of one to 10, he put the chances of the two sides being able to reach a deal at "five."

After Trump's news conference, "the only difference was that instead of seeing the glass half-full, I was seeing it half-empty," MacNaughton chuckled in an interview.

He soon found himself in Ottawa, a critical part of a full-court press to get an agreement done before the Sunday midnight deadline imposed by the U.S. Congress to get the deal fast-tracked and voted on by Dec. 1, ahead of a new incoming Mexican government.

Canadian sources close to the talks say MacNaughton's easygoing style and political acumen -- honed as co-chair of multiple provincial and federal Liberal election campaigns, and former Ontario premier Dalton McGuinty's principal secretary -- proved invaluable.

It's MacNaughton who ensures federal cabinet ministers are ushered onto Capitol Hill during Washington visits to forge one-on-one relationships with American lawmakers -- relationships that bore fruit during the latest round of talks, said Colin Robertson, a former diplomat and U.S. consul general who was part of the team that negotiated the original Canada-U.S. free trade deal and later NAFTA itself.

"This new focus on Capitol Hill -- when legislators come down, they go to Capitol Hill in recognition that Congress really, truly counts, and the cabinet ministers, who are also legislators, have got to recognize that they can use those peer-to-peer relationships."

Indeed, Canadian influence in Congress may have helped discourage U.S. Trade Representative Robert Lighthizer from trying to push senators into approving the bilateral deal he forged with Mexico, said Dan Uczjo, an international trade lawyer in Ohio with the U.S. firm Dickinson Wright.

As talks came down to the wire, Lighthizer encountered resistance on Capitol Hill to approving a deal that didn't include Canada.

"You saw three things come together," Uczjo said.

"The general course of the deal started to be more positive, the USTR became concerned there may be some procedural challenges to his deal with Mexico from the Hill, and I think the White House wanted to ramp up the pressure and started repeating its threats about auto tariffs."

The president became aware of Freeland's attendance at the "Tyrant" event as a plot to prevent Trump from meeting the prime minister at the UN and agreeing prematurely to a deal, a source said.

Forces within the USTR office -- including Lighthizer himself -- were determined to wear Canada down on the issue of the dispute resolution mechanisms embedded in the old NAFTA.

"The president's issue is dairy ... and those discussions were actually going fairly well over the last couple of weeks," said the source, prompting fears the "dealmaker in chief" would agree to a deal in principle with Canada if he met Prime Minister Justin Trudeau at the UN.

"On Tuesday, all the rumblings were that Trump and Trudeau were going to meet at the General Assembly -- in fact, senior-level U.S. officials were telling stakeholders that at private dinners, luncheons, receptions in Canada and the U.S.," the source said.

A deal seemed imminent, worrying those within the USTR who were convinced they weren't yet done, said the source. So the nuclear option was deployed: telling the president about Freeland and reminding him about the summer G7 meetings in Quebec, where Trudeau's closing news conference so agitated Trump that he used his Twitter feed to attack the prime minister from the confines of an airborne Air Force One.

"All of that was done less about blowing up the NAFTA deal, but to stop Trump from making a quick deal."

In the end, the dispute-resolution mechanisms from NAFTA remain largely intact in the new deal, that Trump christened the USMCA.

His victory-lap news conference Monday also drove home the point to all concerned that unpredictability remains the watchword in Canada-U.S. relations. As Robertson said MacNaughton told him last week, "Whether we get a deal or not, the campaign continues -- it's a permanent campaign."

Sign up for our daily political newsletter