The usual civil service metaphor for Brexit is of a series of rocks. Each time you pick one up, all these horrible slimy things crawl out from under it - things you'd never have thought were remotely connected to Brexit. This is an article about the horrible slimy things under the rock named 'aviation'.

European aviation is fundamentally a British success story. It's one of the best pieces of evidence for how Britain made the single market work for its services economy and helped make life better for passengers all over the continent in the process. But that success is now a hostage of Brexit. If the hard Brexiters in Cabinet get their way, Britain will turn back the clock on the last 30 years of development.

This is how the system works. Aviation is governed by a series of treaties. The foundation text is the 1944 Chicago convention, which gave nation states sovereignty over their airspace. You can only fly to another country once you've signed an agreement with them. There's no WTO option or fallback system. You either sign a treaty or you're out in the cold.

Most treaties allow you to fly to a country and back, or fly there with a transit stop on the way - a crucial advantage back in the days when planes could carry less fuel.

And for a long time that was pretty much it. UK flights could go to France and then on to Germany, but they could only do so if they originated in Britain. Every service an airline offered had to be anchored down to the home country.

Then the European single aviation market came along. It was a revolution.

Britain, alongside allies like the Netherlands, convinced more protectionist states to open up their markets. Suddenly, airlines could offer services which were completely disconnected from their home country. Any EU airplane could fly between any two points in Europe it liked. Not only could a UK flight go from France to Germany without originating in the UK, it could set up daily services between Paris and Lyon.

The consequences were immediate. Low-cost airlines like EasyJet and RyanAir sparked into life. Sure, they were almost gleefully uncomfortable and utilitarian, but they hammered down the cost of travel for millions.

The UK aviation industry is now the largest in Europe and the third largest in the world. In 2006, it transported 268 million passengers, sustaining a million jobs, and contributing £52 billion to the economy and £9 billion directly to the Treasury. The EU is its single biggest destination, accounting for just over half of passengers.

No sane British government would ever want to leave a system which has proved so demonstrably successful. Theresa May would almost certainly rather find a way of staying in. But aviation, like every other sector, is a hostage in the internal Tory psychodrama over Brexit.

The single aviation market is part of the EU's legal spider's web. It comes under the jurisdiction of the European Court of Justice (ECJ), which hard Brexiters reject, and has rules established and monitored by EU agencies, which hard Brexiters want to leave.

The most important agency in aviation is the European Aviation Safety Agency (Easa). Everything you see on a plane in Europe has been vouched for by Easa - from the engine, to the landing gear, to the little trolley that goes up and down the aisle with the drinks. It's heavily influenced by the UK and France, who together provide two-thirds of all the rule-making input on European safety regulation.

If you leave it, bad things happen. All the things Easa used to take care of will suddenly have to be done by the UK's Civil Aviation Authority (CAA). You don't even want to think about how much work that entails, or how many members of staff would have to be hired to do it. The level of technical complexity is dizzying.

Ensuring that the plane itself is safe to fly requires certifying 5,000 different parts. And that is just one tiny part of the work that the regulator needs to do. It'll also have to monitor the training and work of any engineer carrying out work on any plane anywhere in the UK. It'll need to have day-to-day oversight of the work done at all 172 maintenance, repair and overhaul sites. Even military training simulators for combat aircraft pilots will come under its remit.

That new regulatory work would come as Britain cut itself off from its largest market. Leaving Easa means we'd be out the continental system and back to the days of old-school bilateral treaties, restricted to flights to and fro. It would be like going back to the early 90s, but not in a fun Netflix series sort of way. Just in a really drab, irritating way. Most analysts expect there to be significant price rises for passengers, of somewhere between 15% and 30%.

This sounds bleak enough as it is, but in reality it would represent victory. Because even getting to this point means we'd have avoided several more catastrophic short-term hazards.

The first is no-deal Brexit. If talks fall apart, UK aviation faces disaster. No deal on Brexit means no deal on aviation - and no WTO-style arrangement to fall back on. Flights from the UK to Europe would have no legal foundation. Even Britain's flights to the US, which are currently validated by an EU treaty, would be affected. It would be chaos.

If a Brexit deal is reached, the transition element means UK membership of Easa would be extended for another couple of years, buying a little more time to hammer out some kind of long-term arrangement. But the third-party problem remains. Britain's flight rights and safety recognition with several other countries - including the US and Canada - both come through EU membership.

This is why the UK recently slipped out a message to world governments requesting that they continue to treat it as an EU member during transition.

In the area of flying rights, this strategy is likely to succeed. No-one gains from chaos in the air and planes grounded in a key global transport hub. The problem is with safety agreements.

The US and Canada will require detailed technical information about Britain's safety regime before they allow flights. Previously this was vouched for by our membership of Easa. But now, no-one knows what the UK is doing.

British ministers will insist that there's nothing to worry about. Our safety standards on Brexit day will be identical to the ones we had the day before. But the US Federal Aviation Administration (FAA) isn't worried about today. It's worried about what we'll be like tomorrow. And it is not getting any guarantees about what a future UK aviation regime will be like, because the government is lost in a civil war between those wanting to stay close to the EU and those wanting complete divergence.

If the UK said it was staying in Easa, these third-party safety agreements would be simple. The nightmare comes if the UK leaves, pumps steroids into the CAA and decides to set up its own regulatory regime. Or worse, if it gets to the autumn without knowing which of these options it'll choose. By then, the Americans will need very detailed technical information about precisely the regime Britain intends to operate, now and in future. The chances of them getting it are slim.

If there are no details forthcoming, the FAA will assume the worst case scenario and act accordingly. Staff will fly in and guarantee for themselves that everything is up to their standards. It will be hugely expensive for the UK aviation industry, which will have to pay by the hour for US officials to check all their processes and procedures, in over 100 UK airports and 172 maintenance and repair facilities. It would also be a desperately humiliating moment for a country which is used to acting as a global leader in aviation. It's akin to being put in special measures.

That is the ugly prognosis for what lies ahead. It involves either the full horror story of no-deal or the still rather alarming problem of third party agreements during transition. And after that, there is a strong likelihood of chronic long-term decline in influence, revenue and passenger freedom.

'Regulatory divergence' is one of those phrases which rightly sends people to sleep. This is the practical reality of what it entails and what the consequences are of rejecting it.

Ian Dunt is editor of Politics.co.uk and the author of Brexit: What The Hell Happens Now?

The opinions in politics.co.uk's Comment and Analysis section are those of the author and are no reflection of the views of the website or its owners.