I’m in a Berlin taxi heading for the airport, and I’m wondering what the taxi driver is thinking about the two Brits in the back of his cab. Apart from our hopeless inability to converse in anything other than our mother tongue, I do worry that, with everything else going on in Europe, our politicians are building us something of a reputation for being a collective “Schmerz im Arsche” (thank you, Google translator).

The outline of a deal for the UK has just been announced, and an early Brexit vote looks a distinct possibility. If the vote is for the UK to leave the EU, the unravelling of many aspects of the UK’s relationship with its EU partners is going to be a painful and complicated task.

The power sector is a good example of the difficulties we might expect. Across the energy supply chain, we’re highly integrated with the rest of the continent.

First and foremost, there are presently four sets of sub-sea cables flowing power to and from Great Britain, with a further three at or around construction stage, and more planned. These interconnectors facilitate cross-border trading of electricity, in accordance with transparent and non-discriminatory rules established in Brussels. The UK consumer benefits from the integration of power markets made possible by these cross border flows, through increased market liquidity and lower prices. UK security of supply also benefits, by the access offered to overseas backup supplies when needed.

But integration of our energy sector with the rest of Europe goes way beyond the physical connections. The high level governance and regulation of power stations large and small, networks, and retail suppliers, and also of the wholesale power markets that serve them, is enshrined in a set of overarching EU Directives and Regulations. The latest batch - the so-called Third Package - has given birth to a range of codes which seek to ensure an ever-increasing harmonisation of rules across Europe.

And that’s even before we get to the new European law (known by its acronym, REMIT) which now regulates behaviour of participants on the energy markets.

With one of the first energy sectors to liberalise many years ago now, the UK has been influential in the development of much of this EU legislation, and UK plc has been a beneficiary as the more monopolistic and protected energy markets elsewhere in Europe have been forced to open up to competition. It is very difficult to conceive of the UK disentangling itself from these arrangements in a Brexit, and equally hard to see how, if it leaves the EU, the UK can continue to influence the ongoing development and implementation of these rules as they continue to evolve.

But there are perhaps other areas where the issues are less clear cut.

A key plank of EU climate change policy is the Renewable Energy Directive, which imposes legally binding renewable energy targets on member states, covering power generation but also heat and transport. It is these targets which have driven the deployment in recent years of solar and wind power across the UK. As we know, these technologies have required subsidy, and this has been expensive for consumers – a debate which is never far from the headlines.

However, massive deployment of renewables is not the only way of reducing carbon emissions. Other options include increased energy efficiency and smarter energy usage, greater substitution of gas for coal, and of course nuclear. With the UK striving to reduce emissions to achieve its own self-imposed carbon reduction targets in the Climate Change Act 2008, who’s to say that our national interests are best served by having our options constrained by a mandatory share of the energy mix for renewables? A similar point could be made in relation to energy efficiency, where the EU has stipulated a range of measures and initiatives that member states must abide by.

But it doesn’t end there. We’re fresh out of the Paris climate talks, where the UK’s commitment to global efforts is defined by an overall EU-wide effort; and that would need some unpicking on a Brexit.

Possibly even more trouble is brewing on a Brexit from north of the border, if Scotland decided to leave the Union in order to stay in the EU. Scotland’s power networks are meshed with those in England, and regulated by the same regulator under the same rules. The whole of Great Britain also shares a wholesale power market. The single all-Ireland electricity market across the Irish Sea could show the way, but that market is complex and itself undergoing some fundamental change to align with EU rules.

Everything will, of course, turn on the precise terms of any Brexit. Until these are known, we can only speculate. But if the UK did decide to head for the exit, the energy sector is going to give politicians a real headache.

Andrew Whitehead is senior partner at law firm Shakespeare Martineau and leads the firm's energy and climate change practice