Seventy-seven years ago this week, the evacuation began of British and Allied troops from Dunkirk. Driven back to the French coast by the German advance, it had seemed that few of them would escape. By 4 June 1940, a third of a million British and French servicemen had been rescued. It was the start of a remarkable summer, around which thick layers of mythology would accrete.

As Britain approaches another crisis with Europe, might the emotional power still exerted by these myths encourage a dangerous path for Brexit and the future? Might the UK be about to face the consequences of its misremembrance of the second world war?

It’s long been a truism that Britain can’t shut up about the war. The conflict remains the setting for popular books and television series, and this summer will return once more to the big screen – with the films Dunkirk and Churchill (which concentrates on the run-up to D-day) depicting its two great amphibious bookends.

Versions of the war swirled round the EU referendum last year – as they must do, it seems, whenever Britain considers Europe. Both sides deployed veterans to make their case. The pro-leave ads concentrated on validating the sacrifices they had made in fighting for freedom against a continental hegemon, the pro-remain on the importance of maintaining peace. The subsequent vote was determined by other factors, but it’s hard to dissociate the mix of English nationalism, dislike of European governments, and the fear of immigrants.

That references to the second world war came readily, if unfortunately, to the ministers charged with making Brexit a success shows just how natural the associations are. An underprepared civil service “coped with world war two – they can easily cope with this”, said David Davis. Called to defend a foreign secretary who had warned the French president not to “administer punishment beatings”, Downing Street insisted he was just “making a theatrical comparison to some of those evocative world war movies that people have seen”. The Colditz Story, presumably, rather than The Sorrow and the Pity.

The reference was significant. Most of those reaching back to the war are remembering not the conflict, but a mediated version of it, first produced for the big screen between the 1940s and the 1960s and repeatedly broadcast on television in the decades that followed. This is the memory of a repeat of a fiction – and all the more powerful for the simplification it has undergone. The process scrubbed out or ignored much of what characterised the British experience of the war – class division, political conflict, European catastrophe and colonial exploitation. The selective version that remains, badly out of step with a more modern, multicultural and multi-ethnic Britain, excludes many of the country’s inhabitants whose forebears were directly affected by the war. For those yearning for a vanished world of wartime unity and late imperial privilege, this is not necessarily a disadvantage.

For those hoping for a positive outcome from Brexit, however, the lessons of the war are hardly comforting. Let us return for a moment to the aftermath of Dunkirk. The events of 1940 represented not just a failure of allied strategy, but the interconnection of British and European security. The UK was able to survive the resultant crisis not because of some fundamental national character but because it remained a great power: wealthy, technologically advanced and at the centre of a mighty maritime empire. Britain’s naval and aerial defences – assisted by émigré forces from occupied Europe – were sufficiently strong to ensure that the Germans could neither invade nor blockade Britain out of the war.

Though the RAF could not prevent the German air force from wrecking city centres by night, the ill-prepared Luftwaffe lacked the strength to launch a decisive bombing campaign. Meanwhile the strategic depth afforded by the Commonwealth and empire and British control over international trade allowed the UK to fight a global conflict, recover from its mistakes, and reorientate its seaborne supply routes across the Atlantic. As British strategists recognised, access to US raw materials and industry was crucial.

The UK was able to survive the crisis not because of national character, but because it still had the empire

Between 1939 and 1941 the British spent billions of dollars building up American arms factories – and with the UK’s stocks of gold and dollars exhausted, sold up British investments in America and appealed for US economic assistance. The American decision to provide that aid was also rooted ultimately in residual British strength. Shared cultural and political values mattered, but so did the perception that, for all that Americans disliked British imperialism, the British empire was a vital ally that needed to be kept in the fight. In 1940, however, the promise of both American help and imperial mobilisation still lay in the future.

The UK never fought “alone” – nor could it have survived if it had – but it was more dependent on its own resources in the period immediately after Dunkirk than at any other time in the war. Significantly, all Britain could do in these circumstances was to refuse Germany a quick victory and hinder its efforts to unite Europe into a functional economic bloc. The resulting impasse underpinned the global expansion of the war, as the consequences of the European crisis rippled around the world.

That expansion laid the path to a much quicker victory, which enabled Britain to emerge from the war much as it had started – wealthy, imperial and with a lot of international power. The arrival of a truly global war, however, also resulted in defeats in the far east that undermined imperial prestige and laid the path to a rapid and violent Indian independence, and sparked the rise of the US and the Soviet Union: new superpowers with their own revisionist international agendas. As it looked forward anxiously to this postwar world, Britain’s account of the conflict became more parochial. The shock of 1940 had stoked a nationalist mood, but official propaganda had always pushed a more international tone: highlighting overseas servicemen, lauding European resistance movements and celebrating the successes of the Red Army.

Lobbying for US aid for reconstruction, however, required a different depiction of Britain’s war, which made the case for recompense by emphasising the scale of what Britain alone had done. Such arguments did little to persuade the Americans, but the British public found them very persuasive. “High time we told the world and blow our own trumpet” was the response of one civilian, when the government published its account of British achievements. It’s never stopped sounding it since. Ironically, such attitudes made it much harder to get MPs and ministers to accept the conditions the Americans imposed on their support.

War might be a poor analogy for the complex negotiations that must accompany Brexit, but as temperatures rise in the Brexit negotiating rooms and the tabloids complain about Brussels trying to order London around, it will be all too easy to fall back on wartime metaphors. The UK, however, does not possess the global power it enjoyed in 1945. Nothing can save it from the grim economic consequences of Brexit, but the danger is that a mood of confrontation pushes the British government towards options that can make things worse for the rest of Europe, sparking a trade conflict or withdrawing security cooperation. One certain lesson of the second world war was that maintaining European stability was a vital British interest. If the mythology of a country standing alone encourages an abandonment of that policy, it will be certainly be a very curious legacy of the war.