President Trump at the Group of 20 economic summit in Hamburg on Saturday. (Sean Gallup / Pool/European Pressphoto Agency)

President Trump’s foreign policy, such as it is, rests on a massive and apparently indestructible contradiction. Trump wants the United States to remain the “essential” nation, the best embodiment of Western ideals of freedom and democracy, while at the same time deliberately alienating many of our traditional allies, whose support the United States desperately needs. American leadership becomes difficult, if not impossible.

It is hard to straddle this contradiction, because it reflects a basic misunderstanding of the American “greatness” that Trump so avidly pursues. To Trump, this greatness is mainly measured in economic terms: the number of added jobs; the trajectory of wages; the rate of economic growth. It is a nostalgic and unrealistic yearning for the economic dominance the United States enjoyed in the 1950s and 1960s.

The truth is that American greatness then and later was never about dollars and cents alone. Prosperity was a means to an end, not an end in itself. The greater objective was to promote democracy and mixed economies, with power divided between the market and government. To advance this vision, the United States advocated open trade and provided a military umbrella. The latter created a geopolitical shield against instability.

Trump sees the costs of these programs as showing that past U.S. leaders were willing to sacrifice the interests of ordinary Americans to meaningless global cooperation. U.S. officials negotiated horrible trade deals; American workers lost their jobs to imports; our putative allies didn’t pick up their fair share of military spending. These “allies” were rivals, not partners.

Although there was some truth to these complaints, they were (and are) fundamentally misleading. The notion that Americans simply abandoned their own interests for Japan’s, Germany’s or South Korea’s — to select a few obvious countries — is counterfactual. Americans thought, correctly, that their embrace of a generous approach to the world exemplified “enlightened self-interest.” Our economic and political interests were served by a prosperous and increasingly democratic global system.

As “grand strategy,” the post-World War II American conception of the world order largely succeeded. The global economy grew richer. A wealthier Europe established stable democracies. The Soviet Union collapsed. America benefited from all of this. There was no World War III. The memory of World War II, coming so soon after World War I, discredited the U.S. isolationism of the interwar period. This backlash was the incubator of postwar U.S. foreign policy.

Now there’s a new era. What role can the United States play? Often, Trump seems of two minds. Last week in Europe, he warned of the dangers of a nuclear-armed North Korea and pledged to remain faithful to America’s ideals of freedom and liberty. But as Trump has surely discovered, running an outward-looking, internationalist foreign policy is hard when your domestic policy is nationalist and inward-looking. Abroad, the balancing act has backfired.

A recent Pew Research Center poll of 40,448 respondents in 37 countries finds a big drop in favorable views of the United States. At the end of Barack Obama’s presidency, 64 percent of foreign respondents viewed the United States favorably; now that’s 49 percent. Respondents were asked whether they had “confidence” that the U.S. president would “do the right thing” in world affairs. In Germany, only 11 percent thought Trump would; Obama’s rating had been 86 percent. In Mexico, 5 percent backed Trump, down from Obama’s 49 percent. Only in Russia and Israel did Trump outscore Obama.

As a result, it’s harder for Trump to lead internationally. Foreign leaders can more easily oppose him without suffering adverse domestic political consequences. He has made it even harder by antagonizing other countries by withdrawing from the Paris agreement on climate change. There was no need; all the pact’s goals are voluntary.

Of course, if your policies aim mainly to increase exports and jobs, none of this matters. But here, too, Trump’s approach may fail. He quit the Trans- Pacific Partnership — a trade agreement with 11 other Pacific Rim nations; many economists consider this a blunder, because Asian economies are among the fastest-growing. And last week, Europe and Japan announced they’re negotiating a trade agreement that covers 40 percent of world trade and excludes the United States. Being outside these agreements would weaken U.S. exports. Further, the European Union warns it might retaliate against the United States if Trump restricts Europe’s steel exports.

What we’re witnessing is extraordinary: a voluntary surrender of power and influence. Trump may believe that trade and environmental issues can be kept separate from geopolitical matters, such as North Korea’s nuclear program. On the contrary, history suggests that trade and geopolitics go hand in hand. To deal with North Korea, Trump needs allies to make economic sanctions tougher or to support military action. He has precious few because he has been so careless in abdicating responsibility for the global trading system.

Read more from Robert Samuelson’s archive.