Attending his last North American Leaders' Summit in Ottawa, President Obama said the U.S., Canada, and Mexico will work closely together to ensure that global stock markets remain stable less than one week after the U.K. voted to leave the European Union. (Reuters)

As he faced the press in Ottawa today, flanked by other leaders of NAFTA signatories, President Obama argued that both the right and left were misleading people about the challenges of global trade. It was true, he said that workers left out of economic growth were growing angrier. As they did so, "the social cohesion and political consensus needed for liberal market economies starts breaking down," as seen in the Brexit vote. But their anger was being misdirected.

"The prescription of withdrawing from trade deals and focusing solely on your local market, that's the wrong medicine," he said. "You are right to be concerned about the trends, but what you're prescribing will not work."

There was no mystery about who on the right and left Obama was talking to. At a rally in Pennsylvania, Donald Trump said that the president and presumptive Democratic nominee Hillary Clinton were wrong to back the Trans Pacific Partnership. In an op-ed published in today's New York Times, Sen. Bernie Sanders told readers that Trump was wrong about the solution but right about the threat.

"We need to fundamentally reject our 'free trade' policies and move to fair trade," wrote Sanders. "Americans should not have to compete against workers in low-wage countries who earn pennies an hour. We must defeat the Trans-Pacific Partnership. We must help poor countries develop sustainable economic models."

With that back-and-forth, Sanders and Obama elevated a debate that has gone on in public and private for years. It has intensified since Sanders began winding down his campaign for president and focusing on changes to the Democratic platform. According to people with knowledge of the platform negotiations, Sanders used his post-primary meeting with the president to say he would push for the party to officially oppose the TPP. The president said he would not allow it. And since then, the White House has leaned on key Democrats to make sure that the platform did not include a rebuke.

That became clear last weekend in St. Louis, when the platform drafting committee -- which includes just five Sanders appointees -- shot down a TPP plank. According to several committee members, the president personally spoke to the drafting committee's chairman, Rep. Elijah Cummings (D-Md.), and the White House did more outreach to make sure that Clinton appointees who might otherwise oppose TPP did not write that into the platform.

The U.S. and 11 other nations have come up with a trade deal after years of negotiations. But what's in it, who hates it, and what happens next? (Gillian Brockell/The Washington Post)

"Both candidates -- Secretary Clinton and Senator Sanders -- oppose the TPP because it has failed to meet the standards that this committee has laid out," said Paul Booth, the executive assistant to the president of AFSCME, and a Clinton appointee. "But the platform committee should affirm what our candidates have said, but not imply that all Democrats are in agreement."

James Zogby, a Sanders appointee to the committee and the head of the Arab American Institute, said the party has already moved firmly against the TPP. That made him question why it would be a dramatic affront to the president to put the party on record for something the congressional party and its labor union supporters largely agreed with.

"No one called me," said environmentalist Bill McKibben, another Sanders appointee. "I eagerly supported the TPP plank."

But on Friday, as Democrats debated Rep. Keith Ellison's (D-Minn.) strong anti-TPP plank, Clinton allies and DNC appointees were blunt. To change the language would be to undermine the president.

"The vast majority of Democrats in the House will not vote for the [TPP]," said Rep. Luis Gutierrez, a Clinton appointee. "That's really not the point. I haven't voted for a trade agreement since I joined the Congress in 1993. Having said that, there are Democrats who believe in the trade agreement. I could say to them: You're not important. I could say that. I've done that in the past. But what I don't want to do is leave this place disregarding the position of the President of the United States."

As the platform drafters explained themselves, only one -- former California congressman Howard Berman -- said that the president was right on the merits about the TPP. Cummings was even more adamant than Gutierrez, suggesting that a TPP plank would undercut a president beloved by Democrats.

"We have one president, and I have listened to him argue his case many times, and I know that he truly believes this," said Cummings. "He really does. I disagree with him, but I don't want to do anything, as he ends his term, to undercut the president. I'm just not going to do it. In his last six months? I'm not gonna do that."

The uneasiness continued when progressive committee members reacted to the platform's passage. Four of Sanders's five appointees backed the platform; all four lamented the watering-down of the trade section.

"Our Party’s platform has always been both aspirational and imperfect," said Rep. Barbara Lee (D-Ca.). "As a member of Congress, I will continue to oppose TPP."

In every public statement since then, Sanders has criticized the committee's decision and suggested that TPP will be a point of contention in Orlando, where the full platform committee meets next weekend, and at the convention in Philadelphia. "It is hard for me to understand why Secretary Clinton’s delegates won’t stand behind Secretary Clinton’s positions in the party’s platform," he said on Saturday.

And outside of the platform committee, Sanders is having no problem finding allies. Zephyr Teachout, a Sanders supporter who won the Democratic nomination for New York's 19th congressional district last night, told the Washington Post that she would oppose the TPP and push for re-negotiation of NAFTA.

"When I talk to people in this district about trade, it’s both about a loss of jobs and a loss of power," said Teachout. "NAFTA, as negotiated, has not helped our workers. I’m really happy to see that we are really rethinking trade."

Rep. Peter DeFazio (D-Ore.), a longtime Sanders ally who stayed neutral in the primary, said in an interview that he wanted the platform to officially oppose TPP, and wanted Clinton to join Democrats like him and oppose a TPP vote in the lame duck Congress.

"That would be definitive," said DeFazio."Hillary has come out against it, and it's so defective in its foundation, with the investor-state dispute resolution, with the lack of enforceable labor and environmental regulations. It's worse than NAFTA."

In Orlando, DeFazio may have a chance to voice that view -- as a superdelegate.

Isaac Stanley-Becker and Anne Gearan contributed reporting.