When Donald Trump talked trade during the first presidential debate, he was working from turf that has served him well. No other issue matches it for distilling the frustrated dreams of millions of Americans.

In the debate Trump singled out the North American Free Trade Agreement, or NAFTA, and former President Bill Clinton for special scorn.

"He approved NAFTA, which is the single worst trade deal ever approved in this country," Trump charged, adding "NAFTA is the worst trade deal maybe ever signed anywhere, but certainly ever signed in this country."

If your opponent is Hillary Clinton it makes sense to focus on her husband, the man who put NAFTA into effect. But the treaty also has Republican roots. In fact, many trade deals of the recent past have had support from both parties.

Was NAFTA the worst deal ever? That’s an opinion, but experts on trade tend to see it as not so bad. The bigger job-killer -- after 25 years of bipartisan trade deals -- has actually been U.S. trade with China. Today, the issue of trade showcases Trump’s break with GOP orthodoxy, and how it has the potential to shake up the electoral math.

NAFTA’s history

Republican President George H.W. Bush negotiated NAFTA and signed the treaty on Dec. 17, 1992, about a month before he left office. It was left to President Bill Clinton to get enabling legislation through Congress. During the 1992 campaign, Clinton supported NAFTA, but he called for side agreements to beef up environmental and labor protections.

It took about seven months to hammer out those agreements. They were bundled into one bill. With solid Republican support, and the help of about half of congressional Democrats, Clinton signed the bill in December 1993.

So Clinton’s fingerprints are on the treaty, but Trump’s claim that NAFTA is the worst deal ever fails on a couple of points.

First, in terms of impact on the economy, the prevailing consensus among economists is that NAFTA has largely been a wash. Not everyone agrees, but most say, by and large, the treaty created about as many jobs as it cost.

The Congressional Research Service, the nonpartisan policy wonks of Congress, summed up NAFTA’s legacy after two decades. "NAFTA did not cause the huge job losses feared by the critics or the large economic gains predicted by supporters," the report said. "The net overall effect of NAFTA on the U.S. economy appears to have been relatively modest."

Which isn’t to say that some industries didn’t lose out. Based on a study by the Organization for Economic Cooperation and Development, workers at firms making everything from small home appliances to clothing took a hit, even as jobs were created elsewhere in the economy.

China and ‘most favored nation’

Today, a broad range of economists think another trade deal did more damage than NAFTA. They say the decision to give China permanent "most favored nation" status was the real job killer, especially in manufacturing.

"Most favored nation" status sets lower tariffs on goods moving back and forth. Since the 1980s, Republican administrations had granted China that standing on a temporary basis.

Clinton followed suit. Throughout the 1990s, Clinton reliably renewed China’s trade status. But during this time, China was pushing hard to become part of the World Trade Organization, or WTO. In the last year of Clinton’s administration, Congress passed and Clinton signed legislation that said if China joined the WTO, then permanent "most favored nation" status would follow.

In 2001, China passed muster with the WTO, and at the end of that year, President George W. Bush signed a proclamation to complete the process. The move led to lower tariffs, spurred investment in China and produced a lot more movement of goods.

It also seems to have taken anywhere from 200,000 to well over 2 million jobs out of the United States. Again, opinions vary. Not everyone faults trade with China for America’s job woes, but plenty of top economists do. Research by Justin Pierce at the Federal Reserve and Peter Schott at Yale University suggest that over 1 million jobs have been lost, or "relocated" in technical parlance, due to trade with China.

In this election, Trump has talked a tougher game on trade than Hillary Clinton, but both have put the free-traders on high alert. Trump has suggested raising tariffs on Chinese goods and aggressively renegotiating current treaties. For her part, Clinton turned her back on the Trans-Pacific Partnership, the signature trade deal from President Barack Obama for countries along the Pacific Rim. (Ironically, the agreement does not include China and was intended to help the United States compete against China’s economic influence.)

China and the election

Voters have taken notice of China’s increasing imports to the United States and connected them to jobs disappearing. Schott and several colleagues looked at the impact of China-related job losses on voting. They found that in counties hardest hit by the change in trade rules with China, voters were more likely to pick candidates who were ready to restrict imports.

But here’s where this election is so different from the past.

That study looked at elections from 1992 to 2010. In that period, this issue favored Democrats. In the hardest-hit counties, Democrats gained a 1.5 percentage point edge at the polls.

"That’s because they saw Republicans as backing free trade," Schott told us. "But to the extent that Trump comes along and says he wants to raise tariffs on Chinese goods, you can imagine that would be popular in these same areas."

Schott added that today, the Democratic stance on trade is muddier than it once was. Obama’s push for the Trans-Pacific Partnership is one high-profile example. Clinton's past support for NAFTA also works against her among these voters.

Economist Robert Scott at the liberal-leaning Economic Policy Institute says there’s a strong overlap between the battleground states and places where workers lack college degrees. These are the people, Scott says, who have been hurt most by global trade.

"You look where low-wage non-college-educated men are concentrated, and it’s in states like Ohio, Florida and North Carolina," Scott said. "And job losses are just the tip of the iceberg. The number of those workers who have seen their wages depressed by trade is ten times bigger."

Scott said Trump directly speaks to these voters.

In Schott’s county-by-county vote analysis, anger over trade gave Democrats the edge in past years. In this election, Trump’s vocal attack on trade could tip the results the other way.