How did they do it? Almost exactly a year ago the EU was reeling from a Brexit vote that reversed 60 years of expansion and threatened the European project with, in the words of one finance minister, a “Lehman Brothers moment”.

Fast-forward to June 2017 and those dystopian visions of disintegration have given way in Brussels to airy confidence. Populists are at bay, the prospect of other countries following Britain out of the bloc has receded and a new French president is on the scene, proud to bear an EU flag.

“My concern on June 24 was the contagion effect would be in play and winning out,” said Mario Monti, the former EU commissioner and Italian premier. “Now it seems to me we can say that rather than a contagion, an antibody effect from Brexit prevailed. I for one have been surprised.”

There are many caveats to that conclusion. But the union is clearly relishing some respite from successive years of gruelling crisis. A change of fortune at the ballot box — in the Netherlands, France, Spain and Austria — has played a part, as well as Europe’s recoil at the politics of Donald Trump.

As EU leaders gather for another summit on Thursday, Donald Tusk, the European Council president, described a union “turning the corner” with “newfound optimism”.

Alex Stubb, the Finnish former premier, who warned of that Lehman moment, asked: “Who would have thought that France would be the epitome of confident reform and the UK and US the ones running backwards?”

The unity forged from the trauma of the summer of 2016 has come at a price. Diplomats joke in Brussels that the EU’s demands over Brexit “promise everything to everyone”. Deciding who bears the cost of compromise has been put off for another day — as have the political sacrifices needed for further integration. The common front is fragile and expectations are high. As Emmanuel Macron of France says, it may be “the last chance”.

Unity comes first

It took many months for Europe to regain its balance after the Brexit shock. But it was thanks in no small part to decisions in the darkest hours after the vote. “We knew this vote to leave would be potentially cataclysmic,” said one senior EU official. “We realised it would be extremely important to show there was a pilot in the plane.”

It was a stunned Mr Tusk who spoke first for the union on the morning after the vote, saying it was “not a moment for hysterical reactions”. A general position had been agreed in calls with EU27 leaders before the referendum: there would be no legal vacuum, unity was paramount, and the benefits of EU membership came with clear obligations. These principles have largely held since.

The EU’s goal was to prevent its founding tenets from being picked apart or its common resolve broken. Ìn seeking to do so, it fell back on what it knows best: process and structure. No formal talks were permitted before Britain activated Article 50, which sets exit negotiation rules that are highly disadvantageous to a departing member state.

For all these defensive steps, in the aftermath of the vote some EU leaders still wondered whether Britain’s clean break from the EU could still be avoided.

Angela Merkel of Germany was one of them, but her view hardened after Theresa May’s visit to Berlin in July. Britain’s new prime minister left the impression that her priority was Conservative party unity. Ms Merkel in turn put EU integrity over and above relations with Brexit Britain. As she hosted assorted European leaders over August in Schloss Meseberg, her summer retreat, the message went out: “Let’s stay together”.

“Europe is not a short-term transaction. The Brits don’t see that, they never have,” said senior European official in contact with Ms Merkel over that summer. “An integral part of our national interest is the union.”

There was one last factor in the union’s favour: Brexit became a vote winner for pro-EU politicians, particularly after Mr Trump’s election. Mark Rutte, the Dutch premier, memorably road-tested the arguments in the days after the referendum. “To everyone who thinks it is a good idea to leave the single market, this is what happens,” he said. “Britain has collapsed — politically, economically, monetarily and constitutionally.”

High demands, high expectations

If there is a signature feature of the EU’s Brexit stance, it is the premium on unity.

The negotiating guidelines for Michel Barnier, the EU’s chief negotiator, allow some space for dealmaking. But there is little restraint in the EU’s headline demands. The sequence for talks — putting divorce issues before trade discussions— seeks to minimise discord by making Britain pay for harmony.

As one EU official remarked to his colleagues, the EU has climbed to the top of the rollercoaster, and now must brace itself for a turbulent ride down.

Behind the willingness to set such maximalist opening demands is EU confidence in its own leverage, and the economic crunch facing Britain. Ms Merkel told colleagues on the sidelines of the June 2016 summit that “the markets would bring [Britain] to the negotiating table”, according to one person present.

The financial hit was not as big as many EU leaders expected. But the logic underpinned a Franco-German assessment: there is little to lose by pushing Britain hard. Uncertainty would force the private sector to prepare, companies to move and Brexiters to sober up.

It underlines the union’s faith in its bargaining power. “There is no hiding it,” said Jean-Claude Piris, former long-serving head of the EU Council’s legal service. “We know we are playing poker with all the aces and kings and [Mrs May] is playing with the other cards.”

The danger privately acknowledged by some diplomats is of the EU setting unrealistic conditions that may put Brexit talks on the path to failure.

That goes for an opening gross bid of €100bn for the Brexit bill — pushed up to its maximum by EU member states who fear a budget gap — and demands for total EU legal jurisdiction to protect the rights of 3m migrants in Britain. Franklin Dehousse, a former European judge, criticised it as seeking to make Britain “some kind of new 1930 Shanghai”, where foreign nationals lived under foreign laws.

But further EU integration remains an optimistic but unrealised promise. Various streams of work have begun in Brussels, Paris and Berlin, from defence co-operation to eurozone and social reform. But to discover what is possible, Europe awaits the German election in September.

Mr Stubb sees big decisions on reform approaching. This time there is no British scapegoat and the political circumstances are different. “There are not many instances in European history where integration has not come with enlargement or a crisis,” said Mr Stubb. “Now we are being asked to deepen integration when the EU is not widening but narrowing.”

The coming year may prove testing. “Europeans are now over optimistic for the same reason they were overly pessimistic six months ago: Brexit, Trump and the populists,” said Pierre Vimont, a veteran former French diplomat now at Carnegie Europe, the international affairs think-tank. “Yet all the problems remain and they may even get more complicated as the Brexit talks will at some point challenge the unity of the EU27, which is largely superficial.”