MONTREAL — Canadians have had enough.

It takes a lot to rile people in this decidedly courteous nation. But after President Trump’s parting shots against Prime Minister Justin Trudeau on the day he left the Group of 7 summit meeting in Quebec, the country reacted with uncharacteristic outrage and defiance at a best friend’s nastiness.

“It was extremely undiplomatic and antagonistic,” Frank McKenna, a former Canadian ambassador to the United States, wrote in an email. “It was disrespectful and ill informed.”

“All Canadians will support the prime minister in standing up to this bully,” he added. “Friends do not treat friends with such contempt.”

Even Mr. Trudeau’s political foes rose to his defense.

“We will stand shoulder to shoulder with the prime minister and the people of Canada,” Doug Ford, the Trump-like renegade who was recently elected premier of Ontario, wrote on Twitter.