In the final days before the Brexit vote, Jean-Claude Juncker had warned that “a deserter not be welcomed with open arms – that is the stance of the commission as well as other governments”. Last year, after a meeting with Theresa May in Downing Street, the European Commission chief declared “I leave Downing Street more sceptical than I was ever before” about the UK’s negotiating stance.

But after Britain’s long goodbye, a bitter parting amid accusations and recriminations, the deal which had been hammered out was not exactly “welcomed with open arms” by the European Union. Rather, it was seen as the best of bad choices, and Ms May was perceived as the one who could realistically deliver it.

The vote last night, which the prime minister won by 200 to 117, was largely received with relief in the knowledge that no new leadership bid can take place for 12 months – the prospect of immediate political upheaval while the Brexit process remains in gridlock was too much to bear for many onlookers in Europe. At a diplomatic reception in the evening the general feeling was that the prime minister was going to win and, when the result came through just after 9pm, there was not a huge amount of surprise. “We can perhaps stop talking about Brexit now all the time until the new year”, an official from a west European embassy remarked, “and then acknowledge that nothing has really been settled yet”.

Throughout the last week the number of emails and phone calls between both EU embassies in London and their capitals have steadily risen. There has been bemusement and amusement as the government was found guilty of contempt by parliament, lost one vote, reneged on its promise to hold another, and then as Conservative MPs organised a putsch against their leader in the critical moment of the Brexit talks.

A diplomat from a Nordic state remarked on Monday: “After decades of predictable politics there has been a move away from the centre in our countries, with the gains made by rightwing parties in Sweden, but also Norway and Denmark, and that is something very unusual. But what is happening in the UK, the country we thought was so boringly stable, is quite extraordinary. It is the most unexpected thing to watch for us. In fact the whole Brexit process has been strange, we never thought the British people would take such a gamble. And now what is to happen, a new prime minister every year?”

In the run-up to the no-confidence vote, there was a dawning realisation in the EU that Ms May desperately needed help. Although the mantra remained that there could be no more negotiations, the offer from Mr Juncker of “further clarity and further interpretations” about the deal came along, with similar messages from Dutch prime minister Mark Rutte and German chancellor Angela Merkel after Ms May’s flying visits to their respective capitals. Irish prime minister Leo Varadkar was also prepared to be emollient, according to officials, before Ms May cancelled her visit to Dublin because of the no-confidence vote.

By Wednesday afternoon, the belief in the diplomatic community was that Ms May would survive. A senior official from a southern European EU member state said: “The speech she made this morning was very good, she came over as determined and passionate. What we were hearing was that she has got the numbers.

“It would have been a huge problem if she had lost. The contest for the next leader would have gone on until towards the end of January and there would have been very little time left after that. There was no chance of new leader many new negotiations, so a no-deal Brexit would have become very real.”

In the first public reaction, Sebastian Kurz, the Austrian chancellor, tweeted to welcome the prime minister’s victory, saying: “Glad about the outcome of tonight’s vote in the UK. Looking forward to seeing Theresa May tomorrow at the European Council in Brussels. Our shared goal is to avoid a no-deal scenario.”

There is also satisfaction about avoiding some of Ms May’s potential successors, had she lost the vote. Some diplomats seemed content that Boris Johnson, who, on a visit to the French embassy for the Bastille Day party during his time as foreign secretary, declared “Brexit Day” “our own version of Bastille Day, of freedom”, appeared even less likely to realise his apparent leadership ambitions. Pascal Lamy, an influential French political consultant and former chief of the World Trade Organisation, reflected: “Let’s be frank, I saw Boris as a nasty young kid and he never changed.”

A French diplomat, once based in London and now back in Paris, gave his observations about two other contenders. “Dominic Raab came after Davis, became famous for not knowing about Dover and Calais and then he resigned to go after May’s job”. And on Jacob Rees-Mogg: “Isn’t there an English saying that ‘life imitates art’? I became quite fond of reading PG Wodehouse when I was in London.”

What the EU can do in the next few days is a matter of urgent discussion. European governments must stress how the withdrawal agreement plainly shows that the backstop looks the least likely option to ever be used, and also that the wording of the agreement is legally binding so there should be no need for separate legal guarantees for the UK.

Support free-thinking journalism and attend Independent events

But there is still hope that even at this stage, good sense will prevail and the UK may stay in the EU. Mr Varadkar has been vocal about this, referring to the European Court of Justice’s ruling that the UK can withdraw its Article 50 notification without the permission of other EU states and stating publicly that Remain would likely win a fresh referendum.