In a Grade II listed building near Liverpool, a buffet lunch was laid out amid Elizabethan-style splendor of dark wood panelled walls hung with portraits, upholstered furnishings and bright chandeliers.

The cold cuts and crudites were picked at as guests broke the ice, but individuals began to look at their watches. This was a popular wedding venue and in the adjoining room a couple were exchanging vows, but the two parties waiting at the buffet tables were surprised how long they were taking.

The couple in question was Boris Johnson and Leo Varadkar. The vows they were exchanging related to consent and customs, but not of the conjugal variety.

"Johnson is multifaceted. But we couldn't underestimate him because he is the guy who can pull rabbits out of hats."

However, their time spent together may well be judged by history as the event which unlocked the Brexit agony.

When they eventually called in their chief advisors there was a bright mood that took them by surprise. John Callinan, Varadkar's chief Brexit advisor and sherpa, and his opposite number David Frost, the UK’s chief Brexit negotiator, were tasked, against expectations, with drafting a joint statement.

The British and Irish leaders had had a detailed and constructive meeting, it said. They could see "a pathway to a possible deal."

The preamble to the meeting in Thornton Manor in the Wirral that Thursday 10 October was a far cry from the positivity that radiated around the oak-panelled room.

On Monday The Spectator had published a long and belligerent text message from a Downing Street insider, presumed to have been Johnson’s combative advisor Dominic Cummings, levelling serious accusations against Varadkar. The next day a further briefing depicted Chancellor Angela Merkel demanding, during a phone call with Johnson, that Northern Ireland remain in the EU’s customs union.

The briefings caused uproar in Westminster and deepened the mood of despair in Dublin and Brussels.  Everyone believed this was a deliberate strategy to collapse the talks and then blame the EU.

Johnson and Varadkar had met in Dublin and New York in previous weeks, and had spoken by phone on the Tuesday. The pair were getting to know each other, but on Brexit they were still very far apart.

One week beforehand, after the Tory Party conference, Johnson had dispatched David Frost to Brussels with a plan that met with such hostility and derision in Brussels, Dublin and Northern Ireland - the one which proposed two borders, one on the island and one on the Irish Sea - that all sides expected London would have to put forward a new proposal.

It was also clear from the Tuesday phone call that Johnson wanted to intensify talks. Until then it was a case of European Commission officials bombarding Frost with questions about the UK plans. 

Read more:
Latest Brexit headlines

But the risks of the Wirral meeting were considerable, not least because of the temper of the Downing Street briefings.

"You could feel the mood was moving in a different direction in terms of the London machine," says one senior official present, "so there was a lot of nervousness about the logic and wisdom of Wirral."

Dublin had anticipated a move from Johnson but the British were not showing their hands. Expectations were low. "Nobody had conceded any ground except to signal that there was a willingness to concede some ground," says the official.

Despite much media commentary about the contrasting figures that Varadkar and Johnson cut when they stood at their lecterns outside Government Buildings in Dublin, officials insist that they are very comfortable in each other’s company.

"Both of them," says one source present in the Wirral, "partly by the nature of their personalities and partly due to a conscious decision to invest some effort in this relationship, are very comfortable together. They can talk openly, engage, be candid and frank with each other, but there’s also an openness to really hearing and understanding the problems on the other side." 

"The British ideas on customs may not really be workable, or would create more problems than solutions."

Before the meeting got under way, both sides felt the best they might achieve was to identify common ground that might shift the tempo of the Brussels discussions.

Instead, something dramatic had shifted. 

What had changed?

Irish officials believe that Johnson and his team were taken aback by the deeply negative response to the Downing Street briefings to The Spectator and on the Merkel phone call.  They were not helping Johnson’s cause.

"They were absolutely at pains to stress that this interpretation that they were hitching their wagon to the hard strategy was not the case," says one official. "The message was, in all scenarios getting a deal at the European Council was his best play. No matter what you think comes after that, every scenario is better if he has that."

The other hint that something was changing was that from time to time Johnson would let slip the slightest hint that he understood the necessity of no land border, or the importance of the all-island economy, even when he was in full flight on technological solutions.

Now Varadkar was able to test Johnson on these glimmers of insight, to see if he was being genuine, to see if he understood the constraints that such insights might put on the UK’s red lines.

Taken altogether, the political alchemy of Wirral accelerated the process towards Thursday’s deal.

Both sides had identified a clear overlap between two conflicting sets of interests, Ireland’s objective of no hard border, and Britain’s objectives of keeping Northern Ireland in the UK customs territory and keeping the DUP on board.

In that overlap the solution would have to be found.

"The rationale for the backstop itself became different and the arguments changed. Everyone agreed months ago that the word 'backstop' will be gone."

The upshot of Wirral was that Johnson accepted there could not be a customs border on the island of Ireland, and Leo Varadkar accepted the need for consent in Northern Ireland.

Once those big political moves were taken, the rest of the work was partly technical, pushing the EU rule book as far as possible, and then selling it at the other end politically.

"In Wirral you had two big trade-offs," says one EU official close to the negotiations, "two big circles to square. Once the trade-off was agreed, those huge issues became technical challenges."

The technical challenges were immense. By ruling out a customs border on the island of Ireland, Johnson was pushing it to the Irish Sea, but then asking the EU for wholesale exemptions from the EU’s customs rule book to soften the impact.

This pushed the EU out of its comfort zone. It was being asked to agree to wholesale exemptions from customs rules for a country which had a poor track record in applying those rules. A case is currently going through the European courts over billions of euro of Chinese goods that allegedly flooded into the single market thanks to poor controls at UK ports. 

"How vigorous will they be in tracking and ensuring all those customs declarations for trade flows from GB to Northern Ireland won’t be fraudulent?" asked one source.

Another official asked: "How do you manage that in real time with a high density of flows. Is it possible to put in place arrangements that copperfasten that?"

Not only that, member states were taking a gamble on an individual with a toxic brand when it came to Brexit.

However, might he be the one interlocutor to make this work?

"Johnson is multifaceted," says one EU source. "But we couldn’t underestimate him because he is the guy who can pull rabbits out of hats. He’s not an ideologue. He’s driven by the narrative, and if through pragmatism you can get to another narrative, then it’s a gamble worth taking."

Brussels also believed that Johnson had recoiled from the idea of a general election campaign based on a No Deal Brexit, while also coming around to the realisation that a hard Brexit really did raise the risk of violence returning to Northern Ireland, something Theresa May’s negotiating team had felt more intuitively.

Julian Smith was a figure of continuity

In this, Julian Smith, the Northern Ireland Secretary, was key. He was a figure of continuity, having been Theresa May’s chief whip during the Joint Report negotiations in 2017, and someone who maintained close contacts with all sides.

So all the elements were lining up. The day after the Wirral meeting Brexit Secretary Steve Barclay told Michel Barnier over breakfast that Britain had accepted there could not be a customs border on the island of Ireland.

While the original backstop, published in treaty form in February 2018, placed Northern Ireland in the EU’s customs territory, the new plan placed the North in the UK’s customs territory, but following the EU’s rules and procedures on tariffs. 

EU and UK negotiating teams got down to business that Friday night, just over 24 hours after the Wirral meeting. The talks ran through the weekend, but the first stock-taking by Michel Barnier did not bode well.

On Sunday evening he briefed EU27 ambassadors on the new plan but they found it confusing and incoherent.  Officials wanted to know how this dual customs regime, untested anywhere in the world, would work. 

"The British ideas on customs may not really be workable," said one diplomat present, "or would create more problems than solutions. They accept there should be no customs border [on the island of Ireland], but the way they want to achieve it is difficult, or it opens things up to fraud, or the system is not very straightforward."

Customs was one thing, but what if goods going from Great Britain to Northern Ireland were ingredients that were would be folded into another product, like sugar for fizzy drinks for example, and then sold over the border and into the EU27?

But as Sunday turned to Monday, EU and British technical teams got down to work. 

Next to customs, the consent issue was fundamental to the change in dynamic. This was to Leo Varadkar as customs was to Boris Johnson.

Dublin had long harboured reservations about the emergence of consent as a lever in the negotiations. 

This was because Irish officials believed that the nature of consent in the Good Friday Agreement was very specific and different to the way it was being applied by unionists to the backstop.

They also worried that consent was just another way of giving the DUP a veto.

But officials began to look at consent differently, once Boris Johnson appeared on the scene.

Here is why:

The original backstop was an insurance policy.  It would only come into effect if other solutions, most notably the future EU-UK trade relationship, were not delivered on time, or if it didn’t deliver the high alignment that would be needed if a hard border in Ireland was to be avoided.

Theresa May believed in a trade deal of close alignment. Boris Johnson didn’t.

That meant that the backstop under Johnson’s vision was a less convincing solution. 

This pushed Dublin into a strategic rethink. Irish officials privately realised that the backstop, that prize that was defended day in and day out by government, would have to go because it did not fit with the new Johnsonian imperatives.

"It wasn’t that anyone sat down and thought it through," says a senior Irish figure. "It kind of evolved. The rationale for the backstop itself became different and the arguments changed. Everyone agreed months ago that the word 'backstop’ will be gone."

In other words, instead of having an insurance policy for what might happen, Dublin needed a permanent solution for what was going to happen.

But if we were now looking at a permanent solution, the consent issue might change from being an awkward factor that Dublin was uneasy about, into being an asset to help bring that new situation about.

Consent shifted the conversation. It opened up the question of democracy and the necessity of Northern Ireland not being forced into something it was not happy about.

By embracing the consent issue, Varadkar could portray himself as a statesman, as someone who was not being obstructive to Johnson’s efforts.

More than that, if Ireland’s mantra from day one was protecting the Good Friday Agreement, it was difficult to object to ideas like consent, even if Dublin contested the relevance of it in a Brexit scenario (where was the consent for Brexit in the first place, for example?).

And the question of consent could also become wrapped up in that other taboo for the Irish government: a time limit to the backstop.

"The Liverpool bargain is," explains a senior EU official, "that the EU and Ireland can’t not engage as something that is framed as democratic. But also it’s a clever way to talk about a time limit without talking about a time limit, by talking about consent. You wrap the two together. You enrobe the time limit into consent.  That makes it difficult not to talk about it, but also much easier to sell."

In other words, implicit in the concept of consent was the possibility of a time limit.  If Northern Ireland wanted to leave the new arrangements, the Assembly could vote for that and that would then be a de facto time limit.

"It gives it a rationale," says the official, "it’s not just an expiry date."

One Irish source goes further: "It’s only a time limit if it becomes effective on foot of a democratic decision.  It’s not a unilateral exit clause, to be used just because someone wakes up in London one day and decides they don’t like it anymore."

But the question of how consent was registered was one of the most fraught elements of the final run-in of the talks this week.

Varadkar had already signalled his acceptance of the concept, saying publicly he did not want to lock Northern Ireland into something it did not want, in order to test what Johnson’s understandings of what the mechanism might look like.

London’s opening gambit was for consent to be required before going into the new arrangements, with a veto for either side. For Dublin this simply wouldn’t work and would make it impossible for the new scenario to come into effect.

However, progress was being made. On Monday morning European Commission officials informed Dublin that there was a qualitative difference in the way the UK team was engaging on consent and customs.

"This was the first time people were convinced: they’re going for it and they’re going to give it the best shot they can," says one Irish official.

Michel Barnier briefed the College of EU Commissioners on Wednesday

Over the next 48 hours ideas were being tested and tweaked in a triangular back and forth between Brussels, Dublin and London. 

On Wednesday morning, Michel Barnier briefed the College of 27 EU Commissioners. The customs arrangements were largely done, leaving only three outstanding issues: consent, VAT and the level playing-field provisions, or the assurances that the UK would not undercut the EU by lowering its environmental, social and labour standards.

On consent, the direction of travel was that the new arrangements should be given time to take effect, to allow businesses to adapt, and then to test their acceptability in Stormont.

The UK had dropped the demand, which the DUP had pressed for, to give Stormont an opt out before the arrangements took effect.

Instead, the arrangements would kick in at the end of the transition period, at the end of December 2020, and four years later Stormont would take a vote.

However, the nature of the vote was important. The DUP wanted the cross-community majority mechanism, which effectively provided a veto for one community or another. 

The EU and Dublin insisted that wouldn’t work. It would have to be by simple majority. 

If the Assembly voted by a simple majority, MLAs would get a chance to vote again four years later.

However, if the simple majority vote was tested for its cross-community support and it was found that a majority of both communities supported the arrangements, then they would remain in place for another eight years.

If there was a simple majority which wanted to end the arrangements, then there would be a two year period during which the Joint Committee set up by the Withdrawal Agreement would seek alternative solutions that delivered no hard border.

If not solutions were found, then the default would be a hard border.  Effectively Dublin was saying this was a risk they were willing to take because they were placing their trust in the will of the people - not least the business community and civil society - to keep the arrangements in place.

On Wednesday morning the EU felt the elements of a deal on the consent mechanisms were almost there.

However, London, under pressure from the DUP, made a final push to nudge things back towards a voting category more amenable to unionists.

The response from Dublin and Brussels was that they would agree if London was sure the DUP were finally on board.

Around lunchtime RTÉ News reported two senior EU sources saying that that had now been agreed, that the DUP had dropped their objections, and that the last major obstacle to a deal was effectively out of the way.

Arlene Foster dismissed reports as 'nonsense'

However, Arlene Foster, the DUP leader, took to social media to dismiss these reports as "nonsense" and that talks were continuing.

"Based on the nature of the engagements we were having," says one Irish source, "which were pretty sophisticated, we got sufficient assurances that one last push would get it over the line, and that happened. We were genuinely taken aback by the DUP response."

British sources suggest papers and ideas on consent were still being exchanged until the last minute.

In the final pressure cooker hours, whether or not EU and UK negotiators had actually signed off on the consent mechanism, the DUP were still pushing Downing Street to go further.

In the event, the text on consent was barely tweaked between lunchtime on Wednesday and early evening, when Michel Barnier briefed EU ambassadors on the final state of play, and did not change at all between that meeting and mid-morning on Thursday when the deal was finally done.

It seems agonisingly close. But in the end, Boris Johnson could not get the DUP on board and decided to drive the bus away anyway.

"We thought the DUP were on board," says one EU official briefed on developments, "and again we were told they were. There was a point where Johnson took a decision that people could no longer be held hostage and everyone needed a deal."

Once again, as in December 2017, the DUP would hold out in keeping with a time-honoured and deeply held negotiating posture.

If their opposition to the deal, which, on the basis of how it was reached, now seems like a miraculous piece of high-speed politcal engineering, will be one of the great ironies of the Brexit era.

Boris Johnson moved the Irish Government into dropping the very thing the DUP hated - the backstop - but he and Leo Varadkar also moved into lockstep on a final compromise, one that was conceived in Thornton Manor.

The DUP liked the first move, but they were blindsided by the second. They may take their revenge in the House of Commons today.