It was as the veteran pollster Stan Greenberg said, “unimaginable”. But as the unimaginable becomes all too imaginable, and the shock sinks in, questions about the election of the 45th President of the US jump to the here and now.

What happened and why? And crucially, from an island that just decided to decouple itself from Europe, what does a more nativist, more inward looking foreign policy, that “always puts America first” mean for peace, security and prosperity?

To try to understand, I turn to two great books: Thomas Friedman’s The World is Flat, which more than a decade ago made the Ricardian case for globalisation as a universal force for good. This helps us understand the why. Margaret MacMillan’s The War That Ended Peace, shows all too clearly how mutual respect between nations, cooperation and internationalism, can quickly evaporate, to be replaced by mutual distrust, hostility and conflict. It’s here, that we see the historical risks of complacency and ignoring the tide of populism.

Over ten years ago, Tom Friedman was the toast of Davos. He had written the definitive book that captured the great promise of globalisation – advances in technology had connected the world like never before and allowed nations like India and China to develop new comparative advantages that in aggregate grew the global economic pie.

He argued that while risks existed with jobs being outsourced from industrialised nations like America, in the end everyone could flourish “with the right imagination and the right motivation”. He believed a new generation of optimists in America would wake up each morning and act on their imagination.

What happened next was different. Working class America continued to be whacked by jobs moving overseas, while millions of middle class Americans lost everything in the 2008 economic crisis at the hands of Wall Street. It became apparent that the economic gains of globalisation were unevenly spread – so much so that working class white men were earning less than they did in 1996.

America was angry; it wasn’t bouncing out of bed imagining a world where it could thrive by trading with the rest of the world. But until last night, we didn’t quite realise how angry. Trump’s promise of doubling economic growth, creating jobs, and crucially the lure of bringing back jobs from countries like China was just too compelling.

But what is the promise worth? If globalisation had a coruscating effect on middle America, automation could well do worse. As blue collar jobs, like transportation and assembly become automated, and professional jobs like doctors, lawyers or accountants face similar fates, we simply won’t see a return to the level or type of jobs America is used to. Quite how an angry America will be pacified and what sort of jobs will be created, is anyone’s guess.

Beyond America, there are big questions about what this all means in terms of maintaining peace, security and order. For the past 70 years, relative peace has been maintained by strong international institutions. European nations saw self-interest in coming together as a bloc, while all the time, America played an active role in global affairs. Brexit and Trump’s victory, combined, potentially puts this equilibrium in peril.

Worryingly, we have been here before. In The War That Ended Peace, Margaret MacMillan recounts the 15 years running up to the outbreak of World War I. Of course, I am not suggesting for a moment that we are on brink of war, but there are uncanny similarities that exist today that we should heed, not least as MacMillan says, “very little in history is inevitable”. Or to put it another way, we don’t have to repeat history.

In the late 19th century there was a feeling that the world had got beyond war. Progress, peace and prosperity had replaced conflict. The world had free trade, limited restrictions on migration, low inflation and limited regulation of capital flows. A wave of technological innovation was revolutionising communications and transport with the arrival of radio, the telephone and the internal combustion engine.  The U.S. economy was the biggest in the world and China was opening up, raising expectations of further economic integration with the West.

Nations came together at the Paris exhibition to share ideas and innovations. The Chinese, the Russians, the great European nations, all exhibited side by side. The pavilion of the Ottoman Empire reflected the mix of ethnicities and religions that made up its people. Governments were providing more rights and benefits for their citizens. Adult education increased and libraries sprung up.  The ranks of the industrialised working classes and the middle classes grew.

But underneath it all fear was playing a role in the attitudes that each nation had to each other. Anxiety around alliances, fears around relative economic strength, mistrust of motivations and ambitions. Nationalism, manifesting as populism, drove the world to the abyss and then over the edge.

On the face of it, the 21st century looks pretty good too, taken overall. Millions are being raised out of poverty, new middle classes emerging in India and China, technological advances offer enormous benefits. We have made major breakthroughs in tackling diseases that a generation ago were incurable. Conflict, certainly on a 20th century scale, seems entirely out of the question.

But the world faces huge (the h is silent!) risks today: a nationalistic Russia reasserting itself militarily in Europe and the Middle East, and using new asymmetric cyberspace tactics to spread misinformation and steal secrets; in the South China Sea, nations face-off over disputed territory which cuts across major trade routes; Syria descends into bloody chaos, Mosul is primed to deliver humanitarian catastrophe; migration in Europe is shifting our politics to a dark place.

We should be concerned when Marine Le Pen, Vladimir Putin and Geert Wilders are first to congratulate Trump.

If ever there were a time that the US, a still, small voice in 1914, can be “great again”, it is now, when it can speak softly, but carry a big stick. If America is great only within its own borders, it will be diminished, as will the strength of NATO, the safety of Europe and the stability of the rest of the world.

Like a supersized version of Brexit – where Britain has washed its hands of the political stability of its neighbours – America could be at risk of allowing a vortex of instability to develop around the world that will eventually blow hard and destructively on its interests.

Unlike Brexit, Donald Trump still has the choice to avoid it.