British Prime Minister David Cameron (Pool photo by Andy Rain/European Pressphoto Agency)

Jim Hoagland is a contributing editor for The Post.

The sick man of Europe today is Europe — both the idea and the continent. President Obama’s long-standing benign neglect of our closest allies is dangerously out of date, as he will discover on his trip to Britain and Germany this month.

Once-shining triumphs of European cooperation and integration have been tarnished by inadequate responses to terrorist attacks in the streets of Brussels and Paris, the unsteady handling of a flood tide of Middle Eastern and North African migrants, and the growing threat of a rebirth of the angry nationalism in Europe that sparked two world wars in the 20th century.

Americans have never found it easy to understand the European Union beyond knowing that it was created to ensure that France and Germany would never go to war again. This was accomplished by forming a loose continental confederation practicing joint trade as well as economic, diplomatic and other policies. And until recently, we didn’t have to go much further than that.

But the confederation’s failure to develop the institutions — and leaders — it needs has been stripped bare by the Old Continent’s agonizing new dilemmas, which are being stoked at home and from abroad.

Syria’s savage war on its own citizens, Turkey’s duplicity on refugees and Saudi Arabia’s financial support for fundamentalist religious movements inside European countries have helped undermine the region’s stability. And Russian President Vladimir Putin’s aggression against eastern Ukraine has plunged Europe back into deep continental insecurity.

But the crisis the E.U. faces is rife with unintended consequences of the union’s own making. Its decision-making machinery, always clunky, has been rendered hopeless by its rapid expansion to 28 members in the push to absorb former Soviet satellites and other states since the end of the Cold War. And the countries of Central and Eastern Europe are in no rush to surrender long-suppressed nationalism to greater integration.

Add in the threat that Prime Minister David Cameron’s ill-advised referendum on Britain’s membership in the E.U. will end in a “no” vote this summer, and you have a strategic disaster in the making.

It is now embarrassingly clear that economic performance in Europe has been uneven during the glory days of globalization. Germany adapted and prospered; France stood still and has suffered politically and economically. The disparity between the two nations has robbed the E.U. of the effective “French-German motor” of leadership that once drove integration.

Germany feels lonely in this unsought solo leadership. Its heavy-handed push for austerity for the Greeks, Italians and others has opened deep fissures in European unity.

Our raucous presidential campaign shows that Americans are exposed to the same troubling currents of epochal change, as the world switches zeitgeists. We move from three decades of a perhaps naively optimistic welcoming of globalization to the abrasive realities of an age of backlash.

An ugly populism focusing on foreigners as the most important source of society’s ills runs through politics on both sides of the Atlantic. Far-right parties in Hungary, France, Poland, Britain and elsewhere demand that national frontiers be sealed instead of flung open. Foreigners must be turned away or surveilled and interrogated.

Cheap imported goods, once eagerly accepted, are now seen as destroying livelihoods at home. Our era of backlash does not distinguish between globalization’s excesses and its successes. Stoking the fires of U.S. isolationism for political gain is to insult the future and to misunderstand our role abroad.

Donald Trump portrays the vast flow of people, goods, capital and ideas across fading borders as having turned the United States into a destitute wasteland unable to afford the forward deployment of U.S. forces that did so much to suppress regional rivalries and bellicose nationalism during the Cold War and beyond. He goes as far as suggesting that Japan should be encouraged to develop a nuclear arsenal rather than spend U.S. dollars helping to protect that country. This is isolationism on steroids.

In interviews with the Atlantic’s Jeffrey Goldberg, President Obama voiced his own frustration over allies becoming “free riders,” indirectly lending support to Trump’s wilder claims and complicating Obama’s scheduled farewell visits to two key European partners.

The U.S. presence in Europe has in fact enabled Americans to serve quietly but consistently as honest brokers among our European allies, keeping historic regional tensions low. The same is true in East Asia. That is a noble mission that needs to be upheld, not disowned.