Theresa May publishes a "Great Repeal Bill" to transfer EU law to the UK.

Thousands of pieces of legislation will need to be moved, amended or scrapped before Britain leaves the EU.

Government to be handed powers to remove EU laws at the swipe of a pen.

House of Lords warn of a "massive transfer of legislative competence from Parliament to Government."

Opponents threaten to defeat the bill unless May makes major concessions.

Defeat on the bill could be the end of May's premiership.

LONDON — The Great Repeal Bill, published today, has been sold as a means of "taking back control" of UK laws from the EU. Under the bill, all existing EU laws will be transferred over to British law, after which the government will be free to rewrite or repeal them at will.

It sounds brilliantly simple, but in reality it is a legal, regulatory and political nightmare which could ultimately lead to Theresa May's downfall as Prime Minister. Here's why:

Repealing EU law is a minefield.

The prime minister announced last year that she would effectively remove Britain from all EU law. She said she would do this through a "Great Repeal Bill" which would "remove from the statute book – once and for all – the European Communities Act."

This would ensure that "our laws will be made not in Brussels but in Westminster. The judges interpreting those laws will sit not in Luxembourg but in courts in this country. The authority of EU law in Britain will end."

Of course, it's not quite as easy as that. Were the prime minister to simply scrap all EU laws, Britain would grind to a halt. So, in the interim period the PM plans to take a "snap shot" of all existing EU laws and transfer them over to UK law where they can later be amended or scrapped at will.

There's one big problem with this.

There's too much of it.

Getting rid of EU law isn't simply a case of repealing one act and cutting and pasting it over into UK law. According to the EU, there are around 20,000 EU legislative acts in force, of which 5,000 apply to all member states. And while some of it's effective by virtue of the ECA, much of it isn't.

Huge parts of EU law are already embodied in both primary and secondary UK legislation, while other parts are not really laws at all but judgments made by the Court of Justice, or rulings by EU regulators. Deciding which parts of this will need to adopted or amended is a bureaucratic nightmare that would take many years to do properly. Britain will have about 18 months.

As Daniel Greenberg, a former Parliamentary council and expert on legislative law, told Business Insider, reviewing all that EU law to see what should be transferred, ditched or amended will be "a civil service legal exercise on a scale that has not been encountered at any other time in our recent legal history."

It's still changing.

The other problem is that we won't know what laws we want to keep until the Brexit negotiations are over.

May has promised to secure a free-trade deal with the EU, but in order to do so, she will have to accept the continuation of a certain amount of EU laws and regulations, particularly in those areas that govern trade. Quite how much she will have to accept depends on negotiation, which almost certainly won't conclude until the last minute. This creates another problem.

REUTERS/Toby Melville

We don't have time.

Unpicking thousands of pieces of legislation and asking Parliament to vote on which bits to keep and which bits to scrap would take decades, several governments and would almost certainly be impossible.

Because of this, the government has another plan and here's where it becomes politically very tricky.

Delegated powers

There's only really one solution to May's difficulties and that is to bypass Parliament altogether. This can be done through the use of delegated powers and statutory instruments. These allow the government to amend laws without first facing parliamentary scrutiny. These powers were intended to be used by governments only for minor time-sensitive technical changes to laws. However, the time pressures caused by May's Brexit timetable means that they will have to be used much more widely and liberally.

This is extremely dangerous.

As the House of Lords Constitution committee warned earlier this year, the Great Repeal Bill will "involve a massive transfer of legislative competence from Parliament to Government."They added that "this raises constitutional concerns of a fundamental nature, concerning as it does the appropriate balance of power between the legislature and executive."

The Great Repeal Bill will hand ministers what human rights organisation Liberty describe as "virtually untrammelled power" to make and unmake whole swathes of our law. Everything from workers rights' to food standards, to banking regulations, will suddenly be up for grabs by Downing Street and it will all happen so quickly that we won't even realise what we've lost until it's gone.

Of particular concern is the clause in the bill stating that the Charter of Fundamental Rights will not be incorporated into UK law.

As Martha Spurrier, Director of Liberty, said today. "If the Repeal Bill passes in this state, people in the UK will lose rights after we leave the EU,"

"It is that simple and the stakes are that high."

Because of this, Labour and other opposition parties have demanded major changes to the bill when it passes through the Commons in the autumn. With Tory rebellions likely, May faces defeat unless she gives ground.

There are no safeguards.

The government has insisted that nothing of importance will be lost. On workers' rights, in particular, they have been keen to dismiss warnings from Labour that citizens' hard-won rights will be lost. The Brexit secretary David Davis has also promised that any major changes will go through primary legislation and be voted on by Parliament. Maybe it will.

Maybe the government really will stand back and refuse to use the sweeping new powers that the Great Repeal Bill affords them.

But the problem is that so far the government have only offered warm words on the subject. There are few safeguards in the bill to prevent the government from simply rewriting Britain's legal settlement at the swipe of a pen. Calls from the Lords for the government to promise to insert so-called "sunset clauses" to make the changes to laws temporary are not in the bill. Calls for a new scrutiny body in parliament to check any changes have also so far fallen on deaf ears.

Defeat could be May's downfall

Labour leader Jeremy Corbyn said after last month's general election result, in which May failed to win a majority, that the bill was "now history". Shadow Brexit secretary Keir Starmer has also said the party plans to vote against it unless May allows a series of major concessions to it.

The clause ruling out adherence to the EU Charter of Fundamental Rights is likely to be the biggest focus of opposition the bill, but there will be others as well.

The failure to explicitly state that EU laws will be devolved back to the devolved administrations could also be a sticking point, with the Scottish and Welsh administrations both saying today that they will refuse to give the bill legislative consent.

Legislative consent motions relate to the convention that devolved administrations must give consent to legislation on matters that they would ordinarily have sovereignty over, under the so-called "Sewel Convention".

This is just a convention, it is not legally binding. The UK parliament has legislative supremacy over all of the devolved administrations. If the Scottish Parliament refuse to sign any legislative consent motions relating to Brexit, the UK parliament can simply ignore it and push ahead anyway. However, any refusal to consent will only increase the likely opposition to the bill in parliament.

With Tory rebellions on aspects of the bill also highly likely, there is a very real risk that it will be defeated, or at the very least heavily amended. Such an outcome would throw into doubt May's ability to pass the mountain of other Brexit-related legislation she has scheduled for this parliament.

After all, the Great Repeal Bill is the just first of eight Brexit-related bills May needs to pass before Britain leaves the EU. To put that into context, John Major was brought down by just one European bill — The Maastricht Treaty, and he wasn't even leading a minority government at the time. Failure for May on this bill now looks highly possible and it's a failure that could spell the end of her time in Downing Street.