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

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 was tested by outside forces, as GOP presumptive nominee Donald Trump continued to question the benefits of free trade and Tuesday's terrorist attack at Istanbul's Ataturk Airport heightened security fears across the globe.

During a joint press conference, none of the leaders mentioned Trump by name. But all of them--and in particular, Peña Nieto and Obama--warned that their citizens should be wary of self-styled populists who promised easy answers to the complex problems of globalization.

Even as Peña Nieto pledged to work with whoever wins this years presidential election in the U.S., he said "those political actors by using populism and demagoguery, they choose the easiest way to solve the challenges of today's world. And things are not that simplistic."

Obama, for his part, delivered an extended lecture on the definition of populism at the end of the press conference--he joked it was one of his "occasional rants"--in which he argued that only those politicians who have toiled on behalf of working people and social justice deserved to claim the mantle of populism.

"I’m not prepared to concede the notion that some of the rhetoric that’s been popping up is populist," he said, adding that someone "who has never shown any regard for workers" does not fit the definition. "They don't suddenly become a populist because they say something controversial in order to win votes.. That's nativism, or xenophobia, or worse."

While they couched their arguments slightly differently--Peña Nieto once again implied Trump has akin to Trump or Mussolini, while Trudeau emphasized "the relationship between our three countries goes far deeper than any individual leaders"--the three men made their close ideological alignment clear. The North American Leaders’ Summit offered them a chance to forge a handful of agreements, primarily on energy and the environment, as well as tout the importance of integrated economic markets.

Trudeau opened their joint press conference by hailing their 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.

Lou Leonard, vice president for climate change at the World Wildlife Fund, said the new 2025 goal is significant because the world will make the greenhouse gas emissions goals outlined in last year’s Paris climate agreement only if nations agree to band together and pursue a common goal.

“If you listen to the news, it seems like the whole world order of cooperation is disintegrating with the Brexit vote,” Leonard said in an interview. “This is a reminder that the work that was done in Paris still has energy and momentum behind it.” 

And both Peña Nieto and Obama paid homage to the ongoing effort to protect the Monarch butterfly, which undertakes an extraordinary migration each year from Canada through the United States and Mexico and has suffered massive population losses due to both habitat destruction and climate change.

"This is a species that, in its pilgrimage, we can see how our countries are intertwined," Peña Nieto said. "Isolationism is not the solution. In contrast with what happens in other corners in the world, the countries in North America, we have decided to be closer, to work as a team and to complement each other and to make progress together as the most competitive region in the world."

Obama, for his part, said of the butterflies, "They're not just any species, they are spectacular."

But the attack in Turkey, which has claimed the lives of at least 41 and injured at least 239 others, 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 and offer support. Speaking to reporters after he held a bilateral meeting with Peña Nieto, Obama emphasized that the Islamic State — also known as ISIL and ISIS — was losing ground in Iraq and Syria.

"They are going to be on the run wherever they hide," he said. "And we will not rest until we have dismantled these networks of hate that have an impact on the entire civilized world."

In the United States, 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, called Brexit, as a sign that voters in many countries are increasingly wary of the impacts of globalization.

But the three North American leaders — including Trudeau, who was just elected in October — sought to push back against this analysis.

Trudeau said that he and others could only combat "protectionism" by providing that enhanced trade doesn't just help the global economy and individual economies, but "are 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 even blunter, saying, "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."

Administration officials are working hard to persuade Americans that closer coordination on energy and other joint policy goals can produce economic benefits. In a blog post published Wednesday morning, White House Council of Economic Advisers Chairman Jason Furman and White House Senior Adviser Brian Deese write that direct and indirect jobs linked to clean-energy generation will rise “from under 700,000 today to over one million jobs supported on average through 2025.”

Reaching the new goal will require trans-border cooperation and projects including aligning 10 appliance efficiency standards and test procedures over the next three years as well as installing 5,000 megawatts of cross-border transmission projects, Furman and Deese write.

Several of the other environmental elements outlined in the leaders’ joint statement represent a continuation of existing policies, including the push to protect and expand the migratory corridor for monarch butterflies across North America and the commitment to phase out any fossil fuel subsidies by 2025. The three countries pledged to lobby for adopting an International Civil Aviation Organization proposal this year “to allow for carbon-neutral growth” in global commercial air travel “from 2020 onwards.” And officials said they would implement aligned fuel and exhaust standards for heavy-duty diesel vehicles over the next two years that would bring soot emissions from that sector “to near-zero levels continent-wide.”

And although the British chafed at the idea that they had to abide by regulations set in Brussels by the European Commission, Breier noted that it’s easier for North American officials to pursue some common objectives when their relationship “is based on sovereignty. It’s a different construct.”

There is no question that North America is already intertwined economically: Canada and Mexico are the United States' first- and third-largest trading partners, respectively, and Mexico ranks as the United States’ second-largest export market. Taken together, U.S. trade with Mexico and Canada exceeds $1.2 trillion each year.

And many goods, including in the auto and aerospace industry, cross borders between the three nations before they are finished and put on the market. “We make things together,” Breier said, “and lots of times, that gets lost in the debate.”