The leaders of North America’s largest three countries signaled Wednesday that they intended to knit their economies and citizens more tightly together, even as European integration is faltering.

APTOPIX Obama US Canada Mexico

But the message of unity that President Obama, Canadian Prime Minister Justin Trudeau and Mexican President Enrique Peña Nieto — delivered during their trilateral meeting here — faced significant external challenges, as Donald Trump, the presumptive GOP nominee for the U.S. presidency, continued to question the benefits of free trade, and Tuesday’s terrorist attack in Turkey heightened security fears across the globe.

During a joint news conference, none of the leaders mentioned Trump by name. But each — particularly Peña Nieto and Obama — warned their citizens to be wary of self-styled populists who promised easy answers to the complex problems of globalization.

Peña Nieto pledged to work with whomever wins this year’s U.S. presidential election, but lamented politicians who use “populism and demagoguery.” He chastized them for choosing “the easiest way to solve the challenges of today’s world. And things are not that simplistic.”

Obama delivered an extended lecture on the definition of populism, joking that it had become one of his “occasional rants.”

In obvious reference to Trump, he said: “I’m not prepared to concede the notion that some of the rhetoric that’s been popping up is populist,” he said. “Somebody else who has never shown any regard for workers . . . in fact, have worked against economic opportunity for workers and ordinary people, they don’t suddenly become a populist because they say something controversial in order to win votes. That’s not the measure of populism. That’s nativism, or xenophobia, or worse.” Peña Nieto compared Trump to Mussolini.

The North American Leaders’ Summit offered the three men a chance to forge a handful of agreements, primarily on energy and the environment, as well as tout the importance of integrated economic markets. But Trudeau emphasized the ties among the three nations. “One of the things that’s easy to forget amid the inflated rhetoric of an election campaign is that the relationship between our three countries goes far deeper than any individual leaders,” he said.

The Canadian prime minister opened the news conference by hailing the leaders’ new commitment to generate half of North America’s electricity by 2025 with clean energy. Officials are defining clean energy sources as not just renewables but also nuclear power, carbon capture and storage plants, and energy efficiency.

“This is what can happen when countries come together in pursuit of a common goal, when we have a big idea and the political will to make it happen,” he said.

But the terror at the Istanbul airport on Tuesday elevated the issue of global security at a time when they were hoping to focus on other priorities.

“It’s a challenging moment,” Kimberly Breier, who directs the U.S.-Mexico Futures Initiative at the Center for Strategic and International Studies, said in an interview. “It’s also an opportunity.”

Obama called Turkish President Recep Tayyip Erdogan from Air Force One while en route from Washington to Ottawa to express his sympathy. Speaking to reporters after a meeting with Peña Nieto, Obama repeated his belief that there was progress in the war against the Islamic State.

“And we will not rest until we have dismantled these networks of hate that have an impact on the entire civilized world,” he said.

Trump has connected with many voters by questioning the benefits of free trade and suggesting he would severely restrict immigration from Mexico and other nations. He has also hailed Britain’s decision last week to withdraw from the European Union as a sign that voters in many countries are increasingly wary of the impacts of globalization.

But the three North American leaders rejected that analysis.

Trudeau said that he and others could only combat “protectionism” by providing evidence that enhanced trade doesn’t just help the global economy and individual economies, but is “beneficial for individual citizens.”

“We know that export-intensive industries pay on average 50 percent higher wages than non-exporting industries,” he said. “We know that trade leads to innovation and opportunities for communities, for individuals, for workers.”

Obama was blunter: “First of all, the integration of national economies into a global economy, that’s here. That’s done. . . . And it is my firm belief that making sure that how we trade, how we exchange goods — it is my firm belief that shaping those in accordance with the values that our three countries care deeply about is going to be good for us.”

Later on Wednesday, the president received an effusive welcome at Canada’s House of Commons, where Trudeau joked they had developed such a rapport that “this house gets to see a bromance up close.”

Obama, for his part, joked but then turned serious.

“How we respond to the forces of globalization and technological change will determine the durability of an international order that ensures security and prosperity for future generations,” he said.

Comments