With the UK election in full swing, the EU is already preparing itself for the next stage of the Brexit process: the negotiations over the future relationship. 

Assuming Britain departs on 31 January, the scale of what will follow makes Tory Party notions about "getting Brexit done" fanciful to say the least.

Ahead will lie months, possibly years of gruelling negotiations on how Britain and Europe interact with each other in the future. 

Everything immediately hinges on the outcome of the election. On paper, a comfortable Boris Johnson majority could see a swift ratification of the Withdrawal Agreement, with Johnson pushing for a formal departure even as early as 1 January.

That is unlikely.

The European Parliament also has to ratify the Withdrawal Agreement and the last available Strasbourg plenary session before the year is mid-December, not enough time for the Withdrawal Agreement Bill (WAB) to be have been pushed through the House of Commons beforehand.

But EU institutions are already busy laying the groundwork. "There's a huge amount of work being done behind the scenes by the [Brexit] Task Force," says one EU source.

We need your consent to load this rte-player contentWe use rte-player to manage extra content that can set cookies on your device and collect data about your activity. Please review their details and accept them to load the content.Manage Preferences

"We want to be ready in case the election results in a strong majority for Boris and he wants to leave on January 1. We're talking to [Commission] Directorate-Generals [DGs] to make sure we're ready for that scenario."

Like every treaty between the EU and a third country, the European Commission does the negotiating on behalf of member states. 

Michel Barnier has already been re-appointed to oversee this process. His Task Force 50 team, assembled for the divorce negotiations, has been merged with the Brexit Preparedness Group, which had been set up to prepare member states for a no-deal outcome.

Individual Commissioners will play a more front line role in the talks, while experts from the various arms of the Brussels will be drafted in as needed. That means that while Barnier will be the overarching chief negotiator, EU Trade Commissioner Phil Hogan, for example, will play a key role when the trade talks are under way.

Putting the future relationship on a legal footing could be - believe it or not - an even greater technical undertaking than the divorce.

It will be intensely political and will have to be done under punishing time constraints. 

Boris Johnson's government is adamant the transition period, during which the negotiations are due to be concluded, will not be extended beyond 31 December next year. 

That means just ten months to negotiate a free trade agreement (FTA) and a broader overall relationship, including a period of time needed for 32 national and regional parliaments to ratify the new treaty.

London will have to decide as early as July whether it needs the transition to be extended. 

Overall, this will be a unique undertaking. Every other EU-third country trade agreement is driven by a mutual desire for convergence.

The UK, by contrast, wants to diverge while still maintaining as much access as possible without EU legal oversight; the EU will insist that the easier the access the higher the level of legal oversight.

Add to that the fact that both economies will become direct competitors. Europe may be preparing, but this is by no means a serene moment.

The institutions are in transition, with the new Commission President Ursula von der Leyen struggling to assemble the new college of commissioners due to a rockier than usual nomination process.

Donald Tusk and his team leave the stage on 1 December, ushering in the former Belgian prime minister Charles Michel, who takes over as European Council President.

Britain’s departure itself is entangling the EU in a legal headache: Will Britain nominate a new Commissioner (and who it might be) and will that hold up the formation of the new Commission?

For the moment, all eyes are on the election. 

In a sweet coincidence of timing, the exit polls on 12 December will roll out just as 27 EU leaders sit down for dinner in Brussels to debate the future relationship, as requested by French President Emmanuel Macron.

In reality, the EU has been pondering that relationship for some time. On the morning of 24 June 2016, just after the referendum result was declared, the EU spelled out how the divorce would work and how the future relationship agreement would be struck.

"Any [such] agreement … will have to reflect the interests of both sides and be balanced in terms of rights and obligations," the statement concluded. In other words, the greater the access the UK sought to the EU’s single market, the greater the obligations to comply with EU law. 

In contrast to the extraordinary divisions within the UK system over how to approach both the divorce and the future, the EU has used that early formulation to forge formidable unity of purpose and preparation. 

Already by December 2016, the EU had established a negotiating team under Michel Barnier who worked closely with member states to prepare for the divorce negotiations.

When Theresa May triggered Article 50 at the end of March 2017, it took EU leaders just four weeks to agree the principles and priorities that would underpin Barnier's mandate. 

Those priorities - no hard border in Ireland, the financial settlement and citizens rights - were stuck to throughout and successfully enshrined in the treaty that Theresa May signed up to, and the revised version Boris Johnson subsequently signed up to. 

Already in March 2018, while May was scrambling to deal with the border, the DUP and hardline eurosceptics, member states and the commission were setting out the broad principles of what the future trade agreement should look like.

In a 16-point document, EU leaders made it clear the future relationship would be shaped not only by their own interests, but limited by the UK’s oft-repeated red lines. 

"Being outside the Customs Union and the Single Market will inevitably lead to frictions in trade," the statement concluded.  

"Divergence in external tariffs and internal rules as well as absence of common institutions and a shared legal system, necessitates checks and controls to uphold the integrity of the EU Single Market as well as of the UK market. 

"This unfortunately will have negative economic consequences, in particular in the United Kingdom." 

These March 2018 guidelines were the product of detailed seminars in which the commission guided member states through all of the areas that will form that future relationship, from trade to transport, from security to police and judicial cooperation, from research to education and so on.

They are essentially the principles which later morphed into the more detailed Joint Political Declaration adopted by both the EU and UK alongside the Withdrawal Agreement.

This will be the sacred baseline for the negotiations. "Everything stems from Political Declaration," said one EU source. "That is the Bible, the text we start out from."

Once the shape of the British electoral landscape becomes clear, the seminar model will be revived and intensified. 

Before advising member states on the granular, technical aspects of each element of the future relationship, and how they will feed into the negotiating mandates, the commission is intensifying its own awareness of the issues.

"It’s about getting our own house in order first," said one source, "looking at all the subjects, getting all the experts in place. That means going through the Political Declaration word by word. What did we mean here? The Political Declaration means a lot more than some people have let on. The words are all very important."

Member states are also anxious that the negotiating mandates, which they will have to endorse, are not sprung at the last minute, if there is swift ratification of the Withdrawal Agreement in the UK.

"It's in nobody's interests if there are surprises in these mandates," said one diplomat. "So we need to find a way to get more collective ownership of these documents when they come. We can't suddenly find a bunch of recommendations on the internet on 1 February. Everyone can see this, but it's not so easy to implement in practice."

Everyone is also aware that they are dealing with a different set of political realities with Boris Johnson compared to his predecessor.

Despite her red lines, Theresa May hoped for a much closer future relationship with the EU than what Johnson wants. This included higher alignment in the regulatory and customs sphere to ensure less trade friction, and the UK signing up to so-called level playing field (LPF) provisions. 

Brussels has long feared the emergence of a low regulation economy on its doorstep, undercutting EU exporters by lowering social, environmental, labour and state aid standards. 

By contrast, eurosceptics (Johnson among them) have long sought a Canada-style free trade agreement (also known as a "bare bones" trade deal) that would not bind the UK to level playing field commitments, but which envisages zero tariffs and zero quotas. 

At the Web Summit in Lisbon on Monday, Michel Barnier warned: "The UK should not think that zero tariffs, zero quotas will be enough."

As another EU diplomat put it: "A number of member states want a close relationship, but a number of other member states don't want to be undercut. Level Playing-Field is an issue that every member state has an interest in ensuring."

EU officials are not entirely convinced that Johnson will still tack hard to such an arms-length trade agreement and a bruising scrap with the EU over level playing field provisions once the election is out of the way.

"Whether that is the eventual British negotiating question is another question," said one diplomat. "If that is his approach then it's going to be extremely difficult for the UK in the future relationship negotiations."

The Political Declaration already commits both sides to seeking a zero tariff, zero quota FTA. But beyond that the UK could face formidable regulatory barriers, and limits to the access that its services sector enjoys to the single market.

In blunt terms, if the UK wants the FTA to be done quickly, in order to avoid extending the transition, then the more "bare bones" the trade deal the better.

However, there are strong indications from London that once we get into the negotiations, Boris Johnson, should he be returned, will look for a deeper and more ambitious trading relationship.

For that reason the Conservative manifesto will be scoured for clues as to what a future Tory government will want, and what trade-offs Johnson is prepared to accept.

Meanwhile, should Johnson fail in his electoral gamble - and the twists and turns this week have made everything feel more unpredictable - the EU will be confronted with a whole other set of headaches.

"People in Brussels are agnostic about this election," said a senior EU official. "There was a sense that the cards were stacked in favour of the government, and a general expectation that we'd have a Johnson majority. That was the baseline for thinking about what we do next. 

"Everyone has now retreated from that. No-one knows how it will end up."

For an agnostic EU, a Johnson majority is viewed as the best outcome. 

"Anything below that brings us into either a stable-ish coalition for a second referendum, or a completely hung parliament where everything is just too frail and where it can’t even deliver a second referendum.

"People just don't want to think about that scenario. It's too horrible." 

How would the EU address a Labour-led coalition?

Labour's position is that it would seek to renegotiate the Withdrawal Agreement within six months and then put that new treaty back to the people in a second referendum.

Officials in Brussels, speaking privately, say the EU would not substantively re-open the Withdrawal Agreement if Labour were in office, but accept that it may be politically difficult to impose Boris Johnson’s Withdrawal Agreement on a Labour-led government.

The EU would have scope to adapt the Political Declaration to reflect Labour's long standing aspiration towards remaining in the customs union and having a "close" relationship to the single market.

One option could be to revert the Irish Protocol back to Mrs May's version, which provided for a UK-wide customs union, something Labour on paper should support. But that could not be a long-term solution because the Withdrawal Agreement is, as we all know, about the divorce, not the future relationship. 

The other problem is this: why would the EU negotiate a deal with a Labour government if it is not sure that that government would support it in a referendum, even if by not supporting it the government supported remaining in the EU?

"That doesn't mean the EU is batting for Remain, far from it," said one official. 

"Some member states would find a second referendum inconvenient and would rather get the Brits out. But that's not an excuse. You would have to engage with the new situation." 

Whatever situation emerges, the EU believes that if the UK leaves on 31 January, it would be able to finalise its own negotiating mandate within four weeks, so the negotiations proper could begin on March 1, 2020.

"This would be much faster than any normal mandate for an EU free trade agreement," said one EU source. 

By contrast, the UK is potentially going to be under immediate time pressure, squeezed on the one hand by the scramble to get everything done in time for the Brexit deadline, and on the other by the need to take a decision by July on whether or not to extend the transition period beyond the end of the year. 

If a victorious Boris Johnson keeps his promise not to extend the transition we are right back in no-deal territory. Remember how long that locked the outgoing House of Commons in agonising paralysis.

This time around the question will be poisoned by money. That's because the notional £39 billion exit bill relates only to a full exit by December 2020. Any extension to that will cost the UK billions of pounds more over a two-year period.

Meanwhile, on this side of the 31 January deadline the new prime minister will have to form a government, pass a Queen's Speech on the new legislative programme, pass the Withdrawal Agreement Bill - all with a Christmas break in between.

Clearly, if the new government has a comfortable majority, then all those hurdles will be easier.

MPs, many of them entering the Commons for the first time, will then have to vote on the UK's own negotiating mandate, or mandates, for the future relationship, and on what kind of oversight the Commons has on the negotiations.

The negotiations will reveal by degrees the more limited the access British exporters will have to the single market. It may also show that the UK's trade ambitions with other third countries, notably the US, will be delimited by what is agreed with the EU.

As mentioned, the trade deal will also have to address what access British services, accounting for 80% of the UK economy by GDP, will have to the single market. Given that a Canada-style trade deal would typically limit free access for services, expect a groundswell of pressure on MPs and the Treasury from British businesses desperate to maintain close access.

There are indications that even during the election campaign, and the "purdah" period, Whitehall will be quietly beavering away on negotiating mandates in order to save as much time as possible.

None of this is to suggest there aren't challenges on the EU side as well. The new European Commission was due to have taken office on 1 November, but Ursula von der Leyen’s honeymoon period has been fraught.

MEPs have rejected three nominees for new Commission (those of France, Hungary and Romania). Romania was the last to put forward a replacement candidate, but all three new candidates still have to be approved by the European Parliament.

These hearings could be concluded by the end of November, but that does not necessarily mean the new Commission can take office on 1 December, especially if the UK persists on not nominating a Commissioner.

In that case the legal services of the Commission, Parliament and Council will have to figure out between them if and when the UK is in breach of EU law and, if so, how the EU should respond.

EU officials believe grandstanding on the issue would not add much value for Boris Johnson, but as he is in full election mode a truculent approach cannot be excluded.

This week, the Cabinet Office issued guidelines to the civil service on the "purdah" restrictions. They state that the "UK should not normally make nominations or put forward candidates for senior international appointments (including appointments to European institutions) until after the election".

Officials in Brussels wonder what "normally" means here. Can the future relationship negotiations be done within the December 2020 deadline? Most observers say it is a tall order.

"Time is tight," said one commission source. "But hopefully we will be able to hit the ground running from our side. That's in an ideal world."

National parliaments will only need to ratify the new treaty if it strays into national - as opposed to EU-only - competences. Most observers believe it will involve national competences, so ratification by individual parliaments, including the Dáil, will have to be got through by the end of the year.

However, EU-only elements of the new treaty could come into effect on a provisional basis.

Given the time pressures, the UK side will want to establish quickly what competences - EU or national - are in play at what stage in the negotiations, so they can calculate what time flexibility is there.

The more elements of EU-only competences that can be completed early, the less pressure there might be on the negotiating timetable.

There are other spheres of interaction which the EU has already prepared legislation for on a contingency basis when faced with no deal, such as transport links, aviation and so on, which are essentially ready to go and may not need to be dragged through the trade negotiations.

But it has to be remembered that in contrast to the divorce negotiations, which were already fraught, there may not be the same unity of purpose among member states.

When it comes to trade, different countries will have stronger "defensive" interests.

The Level Playing Field provisions have the potential to get very political: the more member states demand that the UK sign up to these, the more Boris Johnson will be under pressure domestically from eurosceptics, as Britain would be gravitating back towards the EU’s regulatory orbit.

Boris Johnson has shown himself to be nothing if not pragmatic, to put it charitably.  

The fundamental shifts in policy he took in concluding the Withdrawal Agreement may become a familiar feature over the next 12 months.