President Barack Obama let loose on Donald Trump today for claiming the mantle of economic populism even though he has 'never shown any regard for workers' or fought for social justice.

In fact he 'worked against economic opportunity for workers and ordinary people,' Obama said, incredulously.

Saying 'something controversial in order to win votes, that's not the measure of populism. That's nativism or xenophobia or worse, or it's just cynicism,' Obama protested.

'I care about poor people that are really working hard and don't have the chance to advance,' he declared. 'And I care about workers being able to have a collective voice in the workplace and get their fair share of the pie.'

Obama said when he bailed out the auto industry, it wasn't 'popular' so maybe it wasn't populist.

'Maybe that was an elitist move on my part because it didn't poll well,' he said as he delivered a self-admitted 'rant' at the conclusion of a Wednesday news conference.

The U.S. leader was in Ottawa, Canada, for talks with his Mexican and Canadian counterparts, Enrique Peña Nieto and Justin Trudeau when he delivered his lecture on the definition of populism after reporters repeatedly asked them about Trump.

Trump on Tuesday said he'd rip up their trade pact in his latest assault on the Obama administration.

The White House hopeful said he'd renegotiate the North American Free Trade Agreement if elected, and if Mexico and Canada refuse, he'll inform them 'America intends to withdraw from the deal.'

Scroll down for video

President Barack Obama let loose on Donald Trump today for claiming the mantle of economic populism even though he has 'never shown any regard for workers' or fought for social justice

TESTY OBAMA: Obama said when he bailed out the auto industry, it wasn't 'popular' so maybe it wasn't populist

The North American leaders stood firm today as they rejected his arguments against free trade and reaffirmed their support for the Trans-Pacific Partnership that Obama's administration is pursuing.

'The politics of trade are always difficult in every country. I don't know any country where there are going to be some folks who argue against trade,' Obama said in his opening remarks at the trilateral news conference.

He added, 'But we all agree that we believe that in an integrated global economy the goal is not for us to try and shut ourselves off from the world, but rather work together to raise standards around the world for workers, for the environment and that's exactly what TPP does.

'It's the right thing to do and we're going to keep working for it.'

Obama later said at Canada's House of Commons that how their nations respond to globalization and technological change will determine durability of an international order that will ensure security and prosperity.

'Restricting trade or giving into protectionism in this 21st century economy will not work,' Obama told Canadian lawmakers. 'Even if we wanted to, we can't seal ourselves off from the rest of the world.'

The U.S. president said Britons tried to do that last Thursday by voting to Brexit, and the next day 'people looked around and said, "oh, how's this gonna work?" '

Sizing up the frustration that led to the country's exit from the European Union, Obama told parliament 'people will push back out of anger or out of fear and politicians, some sincere, and some entirely cynical will tap that anger and fear, hearkening back to bygone days of order and predictability and national glory.

'Arguing that we must rebuild walls and disengage from a chaotic world or rid ourselves of the supposed ills brought on by immigrants, all in order to regain control of our lives,' he said.

Obama said the circumstances on that referendum 'may be unique' to the UK, but 'the frustrations people felt are not.'

And while the short-term fallout of Brexit can be managed the long-term trends of inequality and dislocation, 'those can't be ignored.'

Obama later said at Canada's House of Commons that how their nations respond to globalization and technological change will determine durability of an international order that will ensure security and prosperity

Obama said in his speech to parliament that he is 'extraordinarily grateful for the close friendship' he has with Canadian Prime Minister Justin Trudeau, whom he is seen hugging here today

He then proceeded to tell Canadian lawmakers why they should not embrace a British-style exit from continental partnerships

He also reassured Mexico's Nieto today that the country it is not only a neighbor but a friend of the United States as the duo attended the North American Leaders' Summit.

After a private meeting with Nieto, Obama said rhetoric from Trump, whom he referred to in principle though not by name, 'ignores the enormous contributions that have been made by Mexican-Americans and the enormous strengths that we draw from the relationship with our good neighbor to the south.'

'It's been useful for us to reaffirm all the different issues that we've been working on together,' Obama told reporters.

Trump was the talk of the summit publicly, if not privately in the North American leaders' meeting, on Wednesday, with NAFTA and his border security and immigration measures all coming up at the summit's news conference.

Nieto and Trudeau side-stepped specific questions about Trump, saying they would gladly work with whomever is elected to lead the United States next, though Nieto joined Obama in denouncing the businessman's 'demagoguery.'

Obama likewise said 'whoever becomes president of the United States is going to have a deep, strong interest in having a strong relationship with Mexico.'

'That's our neighbor, our friend and one of our biggest trading partners. I think I've made myself clear, setting aside whatever the candidates are saying, that America is a nation of immigrants, that's our strength,' he said.

'Unless you were one of the first Americans, unless you are a native American, somebody, somewhere in your past showed up from someplace else. And they didn't always have papers.'

Trudeau likewise stated in remarks before Obama at parliament that 'Canadians and Americans are united in our understanding that diversity is a sign on strength not weakness,' as he proclaimed that 'the North American idea that diversity is strength is our gift to the world.'

President Barack Obama arrived in Ottawa, Canada, on Wednesday for talks with North American leaders a day after Republican presidential candidate Donald Trump said he'd rip up their trade pact

(L-R)Mexican President Enrique Pena Nieto, Canadian Prime Minister Justin Trudeau and US President Barack Obama arrive for the North American Leaders Summit and Leaders Summit at the National Gallery of Canada on June 29, 2016 in Ottawa, Ontario

PALS: Canadian Prime Minister Justin Trudeau and Barack Obama walk together at the National Gallery of Canada at the start of the North American Leaders' Summit in Ottawa, Canada

The North American heads of state all embraced the Trans-Pacific Partnership that Obama's administration is pursuing, however, even though if the faces opposition from both parties' presidential candidates.

After his meeting with Obama Nieto said, 'We have decided to support each other in order to, in the case of Mexico, have the approval of Congress of the TPP agreement.

'One of the biggest challenges that we're facing...is that we need to be very clear in terms of describing the benefits of being an integrated region,' the Mexican president said. 'Jobs are created. Companies are incorporated. Trade is free. And more development can reach people due to regional integration.'

The comments were an affront to Trump, who is vying to build a wall between the two countries and has threatened to increase tariffs on goods that are shipped between them.

Obama, Nieto and Trudeau have all been critical of the Republican businessman in the past and jointed together today to reject his protectionist approach trade.

'Always there will be people trying to get us all to turn inward, but the fact is our world is interconnected in so many ways,' Trudeau said at the trilateral news conference.

Nieto in March compared to Trump's rhetoric to that of Italian fascist Benito Mussolini and Germany's Adolf Hitler. Trudeau said in December that Trump's instance on coupling extremists with their religion 'is not just ignorant, it's irresponsible.' Obama has repeatedly derided him for 'scapegoating' Muslims and opposes his ban on letting them in.

As he delivered remarks to Canadian lawmakers on Wednesday evening, he thanked them for taking in refugees from countries overrun by ISIS and said, 'We certainly cannot label as terrorists vulnerable people who are fleeing terrorism.'

Obama reassured Mexico that it is not only a neighbor but a friend of the United States on Wednesday

Pressured to his defend his remarks about Trump playing on peoples' fears like Hitler today, Nieto danced around the topic and said, 'We are facing a global reality. We have a populist world, an interconnected world with its own challenges.

'What I have said is that in the world we’re living in different places we have political leaders, political stakeholders that use demagoguery and have a populist slogan that want to eliminate and destroy what has been built.

Nieto said, 'The solution proposed by some is not by destroying what we have built. It is not taking a different route. It is not to choose the road to isolationism and destruction. What we need to do is to keep up the pace towards development,

The Mexican president noted that Obama has also compared Trump's message to leaders of the past who engaged in demagoguery.

'Hitler and Mussolini did that. And the outcome, it’s clear to everyone. It resulted in devastation and it turned out to be a tragedy for mankind,' he stated. 'We saw it last century. That was my message. To value what we have.'

The 'three amigos' of North America were meeting today at the seat of power in Canada as their countries' governments brace for the impact of Britain's exit from the European Union and a changing worldwide economy in the face of globalization.

Obama once again assured North American leaders that the businessman is unlikely to ascend to higher office as he broke bread with them today.

He told reporters on Wednesday after his meeting with Nieto,'The cooperation that's been taking place between the United States and Mexico across a whole range of issues has been outstanding.

'We had the opportunity to discuss the continuing strength of our business, commercial, trade and people-to-people ties.'

Continuing, he said, 'The United States is not just a friend and neighbor of Mexico but the very character of the United States is shaped by Mexican Americans who have shared our culture, our politics, our business.'

Obama, Nieto and Trudeau have all been critical of Trump in the past, and they today reaffirmed their commitment to their trade partnership

Obama is in Ottawa, Canada, for talks with his Mexican and Canadian counterparts

The chaos in Europe was expected to dominate trade talk at the summit and during a trilateral news conference preceding the speech Obama delivered to the Canadian parliament at the conclusion of the meetings.

Then, Trump tore into the counties' intercontinental trade agreement as a job killer for Americans during a speech Tuesday.

'I'm going tell our NAFTA partners that I intend to immediately renegotiate the terms of that agreement to get a better deal for our workers. And I don't mean just a little bit better, I mean a lot better,' he said from Pennsylvania.

NAFTA was approved in 1993 during Bill Clinton's administration. Trump on Tuesday tried to hang it on former first lady Hillary Clinton, now his opponent in the presidential race. The trade deal was one of the 'worst legacies' of her husband's administration, he charged.

On the way to Canada on Wednesday the White House brushed off Trump and his threats.

'I assure you that the president’s trip to Canada to meet with North American leaders today does not directly involve the 2016 race in the United States,' White House Press Secretary Josh Earnest said.

The president's spokesman said the administration's Trans-Pacific Trade Partnership set new terms for trade and repositions communities that have been negatively affected by globalization.

'We’ve already succeeded in renegotiating NAFTA. That’s exactly what the TPP does,' Earnest told reporters traveling on Air Force One. 'It includes obviously countries in the Asia Pacific as well, but it includes Canada and Mexico.'

Obama was last in Ottawa his first year in office, in 2009. It was his maiden trip to a foreign country. Trudeau was not in charge of Canada at the time

Earnest boasted that the Pacific Rim trade deal 'raises standards related to the environment and to labor conditions in all of the countries that have signed the agreement.'

'It also makes those higher standards enforceable in a way that they weren’t in NAFTA,' he said.

Obama made a campaign promise to 'engage with our partners to make changes to those agreements to make them more fair to U.S. workers and the broader U.S. economy,' his spokesman stated. 'That’s exactly what we’ve succeeded in doing.'

At the summit Obama, Nieto and Trudeau also put into operation a North American caucus 'to make a more formal effort' to coordinate on regional and global issues.'

'I think what people will see as a result of this meeting is the value of our relationship, the very special relationship we have with both countries,' a senior administration official told reporters Monday during a call previewing the North American Leaders' Summit.

The countries additionally announced a continent-wide commitment on Wednesday to reaching a goal of 50 percent clean power by 2025 at the fourth annual meeting of its kind.

Obama arrives at Ottawa MacDonald-Cartier International Airport for the North American Leaders Summit. On the way to Canada on Wednesday the White House brushed off Trump and his threats

Obama was last in Ottawa his first year in office, in 2009. It was his maiden trip to a foreign country.

Trudeau was not in charge of Canada at the time. He was elected in October of 2015 and made his first visit to the White House as a head of state in March.

Nieto came to the White House to speak with Obama in 2015 at the height of the border crisis that saw thousands of Latin American minors pouring into the United States through Mexico.

The two leaders spoke privately today but indicated in their remarks afterwards that Trump's proposal to build a wall between the two countries came up.

'Isolationism is not a route towards progress. Integration is,' Nieto said afterward. 'The world is teaching us different lessons when you decide for being in isolation and what happens to those countries that decide not to be in an integrated region.'

Trump says if Mexico refuses to pay for the wall -and Nieto says it won't - he'll come up with the money through fees at the border, tariffs and cuts to foreign aid.

Obama speaks with Governor General of Canada David Johston after arriving at Ottawa MacDonald-Cartier International Airport for the North American Leaders Summit

The fourth annual summit is Obama's last. Next year, Nieto and Trudeau will find themselves negotiating with Trump or Hillary Clinton. Clinton's husband signed NAFTA into law

The United States does 1.2 trillion dollars in trade with Canada and Mexico.

Canada is its largest trade partner. It's trade relationship with Mexico is more lucrative than the business it does with India, Canada, Russia and China combined, the White House said Monday.

The White House has made the stabilization of the United States' relationships with the EU and separately the United Kingdom the focus of its diplomatic efforts this week following last Thursday's jolting vote.

Now more than ever, the administration is emphasizing the importance of both countries' participation in the 28-member North Atlantic Treaty Organization.

Also sure to come up: Brexit. 'Certainly we anticipate that they'll have an opportunity to discuss Brexit and what it means for our economies and how we can best coordinate our efforts,' the White House said this week

The chaos in Europe was expected to overpower the energy aspect of the summit during a trilateral news conference and a speech Obama will deliver to the Canadian parliament at the conclusion of the meetings - then Trump trashed NAFTA

Nieto in March compared to Trump's rhetoric to that of Italian fascist Benito Mussolini and Germany's Adolf Hitler. Trudeau said in December that Trump's instance on coupling extremists with their religion 'is not just ignorant, it's irresponsible'

OBAMA'S SCHEDULE IN CANADA 10:15AM The president arrives in Ottawa, Canada 10:50AM Obama greets Prime Minister Trudeau of Canada at the National Gallery of Canada 10:55AM President Obama participates in a bilateral meeting with President Nieto of Mexic at the Canadian Galleries 11:40AM The president participates in a North American Leaders’ Summit working session 1:40PM North American leaders take a family photo 1:55PM Group engages in a working lunch 3:00PM Leaders participate in a trilateral press conference 4:20PM Obama participates in an arrival ceremony with Trudeau at Parliament Hill 4:35PM The president holds a bilateral meeting with Prime Minister Trudeau in the Cabinet Room 5:25PM The President of the United States addresses the Canadian Parliament in the House of Commons Chamber 6:45PM Obama participates in an Embassy meet and greet on Parliament Hill 7:35PM President Obama departs Ottawa, Canada en route Washington, DC Advertisement

U.S. Ambassador to the United Nations Susan Rice said Sunday at a conference that brings together government officials and business leaders that pressure on the security organization to 'stay latched up will be even greater.'

Rice insisted there will be 'relatively few' security concerns with Britain leaving the EU given its continued participation in NATO.

'We will do all we can to ensure that the areas in which we are cooperating -- counter-terrorism, you name it, will remain solid,' Rice said.

France, Germany and Spain are members of NATO, which has its annual meeting on July 8 in Poland, in addition to the UK, US and Canada.

Obama sent Secretary of State John Kerry to the EU's headquarters in Brussels this week to meet with President Jean-Claude Juncker and EU High Representative Federica Mogherini along with NATO Secretary General ens Stoltenberg.

Yesterday he was in London for meeting with Cameron and his British counterpart Philip Hammond.

Kerry joined Obama in Canada for the one-day summit at which Obama held both joint and one-on-one talks with Nieto and Trudeau and a trilateral press conference.