On every measure, mankind is enjoying a golden age. We are living longer, happier, healthier lives than our grandparents could have imagined. The improvements are most dramatic in developing countries where, as in Europe a century ago, agrarian economies are turning into consumer societies.

What has made this transformation possible? What is lifting our species to an unprecedented level of wealth? What is reducing infant mortality, educating girls, creating leisure time, incentivizing eco-friendly technologies? Free trade. The spectacular improvements in literacy, longevity and calorie intake have coincided with the post-war development of a global market.

The countries that are now embracing that market most readily, such as India and China, are benefiting from the most miraculous transformations. Those that stay outside it, such as Zimbabwe and North Korea, remain mired in misery.

Yet, bizarrely and tragically, the United States is in danger of turning its back on the free-trade system that it played such a brave role in establishing. I can't think of a previous presidential election in which both main candidates were so hostile to liberalizing international commerce.

Both Hillary Clinton and Donald Trump have come out against the Trans-Pacific Partnership (TPP). To give you an idea of how countercyclical this is, the United Kingdom, which just voted to leave the EU partly because it wanted the freedom to sign its own trade deals with non-European countries, has floated the idea of signing up to TPP.

True, we're not a Pacific country, but we have exceptionally close links with lots of the signatories, including Australia, New Zealand, Canada, Singapore and Malaysia — as well, obviously, as the United States, which is both our largest source of and our largest destination for overseas investment. Joining TPP might be quicker and easier than negotiating separate trade deals with its individual signatories.

To be fair, there are criticisms to be made of the TTP — and of its sister, the Trans-Atlantic Trade and Investment Partnership (TTIP). Some argue that these deals have more to do with regulatory control than with trade liberalization, and that they will make life easier for established cartels but harder for start-ups.

This, though, doesn't seem to be the objection of either presidential candidate. Their position owes far more to 1930s-style protectionism. Donald Trump, in particular, rages against the idea of signing trade deals with countries that have lower production costs than the U.S. — which rules out more than 90 percent of the world.

Protectionism has a certain appeal in every age and every nation, because of what we might call a piece of faulty wiring in the human brain. Our instincts were evolved on the savannahs of Pleistocene Africa. We have an ingrained tendency to provide against famine, to hoard food. Translated into the modern economy, this makes us fret about "dependency" on overseas suppliers.

In fact, it is by concentrating on what we do best, and buying other goods and services from elsewhere, that we generate prosperity. If you want to see a place that has elevated self-sufficiency as the supreme goal of economic policy, go to North Korea.

Free exchange is beneficial even when overseas suppliers can undercut us across the board. Two centuries have passed since the economist David Ricardo demonstrated why, logically, free trade must always benefit all its participants, even if one country is less productive than another in every single sphere of activity.

His theory, known as "comparative advantage," has been described as the only idea in the whole of the social sciences that is both surprising and true.

The trouble is that it is counterintuitive. Free trade between the United States and China would lower costs for American consumers, giving them more disposable income and boosting the entire economy. But the winners would be unlikely to notice, let alone attribute their good fortune to free trade.

The losers, by contrast — and there are always some sectors that suffer, though the net impact on the economy is positive — would know exactly whom to blame, and would vote accordingly.

I suspect that, deep down, both Donald Trump and Hillary Clinton understand all this. They understand that reflecting people's gripes back at them is easier than explaining a complex idea. And so, from a combination of laziness, cowardice and opportunism, they are in danger of inflicting upon America the same autarkic thinking that has blighted Zimbabwe, with this difference: Zimbabwe is tiny. Its protectionism hurts only one country. American protectionism, by contrast, would impoverish an entire planet.

Dan Hannan is a British Conservative MEP.