When Boris Johnson was elected leader of the Tory party on 23 July 2019 there were plenty of sharp intakes of breath in Dublin and Brussels.

He was universally disliked. He had a central role in Vote Leave and the slogan on the red bus, a record of untruth-telling about the EU as the Daily Telegraph's Brussels correspondent, and an embrace of Donald Trump.

In January 2017, he had compared the EU to a Nazi concentration camp commander doling out punishment beatings.

It was also impossible to know which way he would turn on a given policy.

"That element of unpredictability and the deliberate do-the-thing-they-least-expect approach is definitely part of the character," said a senior Irish official at the time. "So it does make predicting things even more difficult."

It was already an unpredictable and highly charged moment. The outgoing Theresa May had had a miserable time, negotiating a Withdrawal Agreement that was rejected four times by the House of Commons. She left Downing Street in tears.

Johnson had promised to "bin" the backstop that formed the Irish part of May’s deal, and if the backstop was not gone he would be happy with a No Deal exit.

The House of Commons was paralysed. There was a growing move for a second referendum, or a referendum on whatever exit deal Johnson might secure. The Benn-Burt Extension Act would soon oblige Johnson to either get a deal or seek an extension; it forbade him from going for No Deal.

Johnson filled his cabinet with pro-Brexit ministers. He appointed the Vote Leave svengali Dominic Cummings as his special advisor, a move that was arguably even more dispiriting for EU officials, who had relied on backchannel contacts with Number 10.

"Do you really want to be speaking your mind [as a UK official] when all of that is going to go back to Cummings?" asked one EU official.

Cummings’ appointment also raised suspicions Johnson was going for an early election, more turmoil ahead of the exit deadline of 31 October 2019.

The EU, meanwhile, was wondering how on earth Johnson could deliver on the expectations he raised during the leadership contest about binning the backstop and having a customs and regulatory border on the island of Ireland.

Another senior EU diplomat said: "The longer he waits he will have to reconcile the impossible claims he made during the campaign. They will hit the hard rock of the EU, and will then hit the hard rock of the [Brexiteers] because of the compromise he will have to make."

Johnson was also completely at sea on the detail of the Irish question. On 16 September he had a sobering meeting in Luxembourg with Jean-Claude Juncker, the then European Commission president, and the EU’s chief negotiator Michel Barnier.

By that point. Johnson had agreed to a goods and SPS (sanitary and phytosanitary) border in the Irish Sea, but was insisting on a customs land border.

Stephanie Riso, a senior commission official, spent ages explaining to Johnson the principles of avoiding a hard border, what the difference between customs and SPS checks were, and why his ideas were not compatible with no hard border.

It was also at that meeting that Johnson raised the idea of giving Stormont a consent vote (the very mechanism that Johnson’s current protocol bill could easily overturn).

"There was a discussion about consent," said one official briefed on the meeting. "How you give Stormont a role in all of this? It’s a UK thing, so they said they would have to reflect further."

On October 2, Johnson formally presented his alternative to the backstop.

Northern Ireland would fully align with the EU single market on industrial goods and agrifood products, meaning a regulatory border along the Irish Sea, and an enforcement role for the European Court of Justice.

Northern Ireland would, however, leave the EU’s customs union and the subsequent customs border would be managed through a mix of exemptions and derogations, technology, checks away from the land border, data exchange and so on.

The consent mechanism first mooted in Luxembourg was fleshed out to an effective DUP veto, either before the new arrangements came into effect or every four years afterwards.

Dublin and Brussels were aghast. Northern Ireland businesses said it created not one but two hard borders. The EU was hardballing and Johnson thought they were doing this to shake up Westminster into having a second referendum. Cliff edges abounded.

Johnson then held his famous meeting with Leo Varadkar at Thornton Manor in Cheshire. It resulted in the outline of a deal, which then went to the commission and member states.

In essence, Johnson moved on customs, agreeing that Northern Ireland would apply EU customs rules but remain part of the UK’s customs territory. Varadkar moved on consent. It would not be a DUP veto. Instead, Stormont would vote on the protocol every four years on a simple majority basis.

The deal was done at an EU summit, the 31 October cliff edge came and went, a membership extension was agreed to 31 January 2020 (with a transition period running till the end of 2020) and Boris Johnson won an 80-seat majority in a general election in December under the slogan "Get Brexit Done".

In reality, relief that a Withdrawal Agreement got over the line in October - and a No Deal avoided - was tempered by the instinct in Dublin that this agreement was a messy compromise that had no buy-in from the DUP.

A Joint Committee was set up to manage the protocol, but throughout 2020 another rift was growing between Johnson and the EU. Johnson was saying publicly there would be no need for paperwork on goods going in any direction GB-NI, while the UK seemed to be dragging their feet on building the infrastructure at ports to facilitate checks.

The future relationship negotiations were getting under way at the same time.

Johnson and his chief negotiator David Frost were going for a much harder Brexit than Theresa May had envisaged.

The prospect of diverging from EU regulations prompted Michel Barnier to demand a level playing field, so that the UK would not get privileged access to the single market if it was undercutting social and environmental standards.

Trust plummeted again when Johnson introduced the Internal Market Bill that would override aspects of the Northern Ireland Protocol.

By early December 2020, a No Deal scenario looked highly likely, meaning the UK trading on WTO terms.

In the event, a deal was done at the last minute (Christmas Eve 2020).

However, barely had the ink dried when clashes over the Northern Ireland Protocol and over Covid vaccine procurement issues deepened the antagonism between Johnson and his EU interlocutors.

In the weeks leading to the collapse of Johnson’s leadership that antagonism has worsened due to the protocol bill, which dismantles the protocol to an even greater extent than the Internal Market Bill.

The fact that the tipping point for Johnson being turfed out of Number 10 has been his handling of a sex pest, rather than for breaching international law (as the EU sees it), means there are few expectations of a reset.

"Johnson’s legacy speaks for itself," says one EU diplomat. "But as much as some people in Brussels might enjoy the clown carnival that is going on in Westminster, unless this rebellion also means a change of attitude towards the underlying Brexit issue it remains a big question mark for all of us."

The fact that the bill will continue its passage through the Commons regardless has also tempered expectations.

"I can't imagine anyone holding it up at this stage," says one Brussels source. "Look at how it passed the first reading - with flying colours. We’re going to have either Johnson as caretaker or another caretaker government. In neither of those scenarios can I imagine anyone saying, let's just slow things up."

Equally, most of the leadership candidates mentioned - Liz Truss, Sajid Javid, Rishi Sunak, Jeremy Hunt, Penny Mordaunt, Ben Wallace, Steve Baker, Suella Braverman - are enthusiastic about the bill (Liz Truss is, of course, the bill’s author), or at least not opposed to it.

EU officials fully expect support for the bill to be a defining credential in the leadership race. Needless to say, the support of the protocol-hating European Research Group (ERG) will be vital for any candidate.

"Leadership campaigns tend to correct towards the extremes rather than towards the middle," says one diplomat. "That doesn't automatically bode very well for the Brexit issue."

Other officials are less pessimistic.

"In any campaign you will hold some extreme public stances and then once you have won you can move into more shallow waters and try to be a bit more pragmatic," says one official. "We’d be hoping for that. But we really don't know."

Johnson was thoroughly disliked and distrusted by most EU leaders (the occasional bromance arm-in-arm pictures with Emmanuel Macron belied a genuinely negative view of the prime minister held by the French President).

"Johnson’s legacy in Europe is entirely negative," says a long standing official.

"The only redeeming feature was Ukraine, but Ukraine would have been the same whoever was prime minister. People will think Brexit, they'll think Northern Ireland Protocol, they’ll think vaccine wars before they think Ukraine."

Johnson’s departure, however, is not a guarantee that the hard Brexit, Vote Leave culture he introduced to Downing Street will be weakened within the parliamentary party.

The bill is expected to pass the Committee Stage next week with the third reading coming in September. If it becomes law by the end of the year then the EU and UK will be on a collision course that will almost certainly entail some kind of trade war.

UK sources say that there could be a lacuna between when the bill becomes law and ministers using its powers (to replace whole swathes of the protocol), and that in that gap, if negotiations have resumed and are reaching a critical stage, then the powers would not be used.

They also say, however, that a Rubicon has been crossed and that there is no way parliament is legislating for powers that ministers do not intend to use.

The EU remains of the view that the bill is a gun on the negotiating table and that it cannot make concessions to the UK under these terms. Senior British officials have been holding informal meetings with the European Commission, but the commission has rebuffed any attempts by these officials to "explain" the detail of the bill.

"The commission are keen to tread water for now," says another EU diplomat. "They don't think the time is ready to start any serious negotiations. And everybody is waiting to see what's going to happen in London."

Nonetheless, attitudes in member states are hardening, particularly in Berlin, and particularly when it comes to a potential trade war.

"The view in Berlin," says the diplomat, "is that all along the British have misread the German position. From the earliest days, the idea that the German car industry interests would trump anything else, that the Germans would want a soft Brexit, and would put up with a lot.

"They are very strong on this. They're totally behind the commission, and the EU position, that if the Brits go ahead and pass the legislation we will be exploring all options in depth. The Germans are ready to move."

That reality will likely get lost in the clamour of the upcoming leadership battle. But Boris Johnson’s replacement will find it in his or her in-tray when they enter Number 10.