Repeal bill: All you need to know
The day after triggering Brexit, the government published details of its "Great Repeal Bill". Described by Theresa May as an "essential step" on the way to leaving the EU, it aims to ensure European law will no longer apply in the UK.
It is now being introduced to Parliament, with the formal title of the European Union (Withdrawal) Bill. Here's how it will work:
What it's all about
As its informal name suggests, the repeal bill will repeal the 1972 European Communities Act, which took Britain into the EU and meant that European law took precedence over laws passed in the UK Parliament. It will also end the jurisdiction of the European Court of Justice.
All existing EU legislation will be copied across into domestic UK law to ensure a smooth transition on the day after Brexit.
The government says it wants to avoid a "black hole in our statute book" and avoid disruption to businesses and individual citizens as the UK leaves the EU.
The UK Parliament can then "amend, repeal and improve" the laws as necessary.
Ensuring the continuity of EU rules and regulations is also meant to aid trade negotiations with the EU because the UK will already meet all of its product stands.
Sounds complicated...
The repeal bill is likely to be "one of the largest legislative projects ever undertaken in the UK", a report by the House of Commons library predicts, with "major swathes of the statute book" needing to be examined to see how they will work after Brexit.
This is because working out which bits of UK law came from the EU is not as simple as it may sound.
In fact, it presents a "unique challenge", a House of Lords committee warned recently, because "the body of EU law is found in a number of different places, and in a number of different forms".
Simply transposing all EU law into UK legislation will not be enough, the government's White Paper on the bill says.
Swathes of UK law "will no longer work" on exit, for example because they refer to EU institutions.
Not all of this can be done through the Repeal Bill, so the government plans to create powers to "correct the statute book where necessary" - without full Parliamentary scrutiny.
This is the one of the most controversial features of the bill (see below).
More complications are presented by the government's negotiations with the EU, which will be taking place while the bill is passing through Parliament.
Those talks could shape what the UK's post-Brexit laws look like - but the repeal bill will need to be done and dusted by the day the UK leaves.
What's Henry VIII got to do with it?
The government plans to enact its "corrections" to the statute book using what are known as Henry VIII powers, after the Statute of Proclamations 1539 which gave him the power to legislate by proclamation.
Given that this will not involve the usual Parliamentary scrutiny process, opposition parties have protested, with Labour claiming ministers were being handed "sweeping powers" to make hasty, ill thought-out legislation.
Ministers have attempted to reassure critics by saying such measures will be time limited and not used to make policy changes.
In total, the government estimates that 800 to 1,000 measures called statutory instruments will be required to make sure the bill functions properly.
How much EU law is there?
A lot.
The government's White Paper says there is "no single figure" for this, but that there are believed to be 12,000 EU regulations (one type of EU law) in force, while Parliament has passed 7,900 statutory instruments implementing EU legislation and 186 acts which incorporate a degree of EU influence.
The total body of European law, dating back to 1958, is known as the Acquis Communautaire.
It binds all member states and in 2010 was estimated to consist of about 80,000 items, covering everything from workers' rights to environment and trade.
As well as regulations, this includes EU treaties, directions and European Court of Justice rulings.
New EU legislation is being created all the time and will continue to apply to the UK until it leaves.
Different types of EU legislation work in different ways, and will be treated differently by the bill. So regulations, which apply automatically in the UK, will be converted into UK law.
But directives require a new UK to come into force - this legislation will be preserved by the bill.
Reality check: How much UK law comes from the EU?
What's happening when?
The bill was included in the Queen's Speech in June and will be introduced to Parliament on 13 July.
It will then have to pass through both Houses of Parliament. The plan is for it to be passed ahead of the UK's exit from the EU but to become law only when it actually leaves.
Under the formal timetable for negotiations, the UK is due to leave the EU in March 2019 unless both sides agree to an extension.
What do other parties say?
Labour has said there is not enough accountability over the "sweeping delegated powers" ministers will give themselves to alter legislation and claims the bill represents a "power grab" by Westminster over the devolved administrations.
The party has warned that the government faces defeat on the bill unless it agrees to concessions in areas including parliamentary scrutiny and workers' rights.
The Liberal Democrats have warned that getting the bill through Parliament could be "hell" for the government, with leader Tim Farron saying: "If the government try any wheeze or trick to force through changes to vital protections, from workers' rights to the environment, they are playing with fire."
During debate on Queen's Speech in June, 101 MPs backed an amendment calling for the UK to stay in the single market after Brexit, including 50 Labour rebels.
What else do we know?
The Queen's Speech contained a number of other bills over the next two years to prepare for specific aspects of Brexit, including on customs and immigration.
When it published the White Paper in March, the government also confirmed the UK would be withdrawing from the EU's Charter of Fundamental Rights, the EU's human rights agreement, and that it would not be converted into UK law.
The government said the charter was "only one element of the UK's human rights architecture" and it had no plans to pull out of the European Convention on Human Rights, a separate agreement which is not part of the EU.
Ministers have also clarified that once the UK leaves the EU, European Court of Justice judgements will have the same status as UK Supreme Court decisions, which can be overturned by subsequent rulings.
After Brexit
Until the UK actually leaves, EU law will continue to apply. But after leaving, the European Union (Withdrawal) Act (as it will be by then) comes into force.
The government says having the legislation in place will ensure a "calm and orderly exit". Then begins the long-term process of the government, and Parliament, choosing what it wants to do with the laws it has incorporated from the EU.
With so many pieces of legislation to be considered, this could turn out to be a "major drain on resources" and should not "crowd out" other government policies, the Institute for Government think tank has warned.
How about Scotland, Wales and Northern Ireland?
Some of the EU laws are in areas that are controlled by the devolved administrations - so do they now become part of Westminster law, or will they be added to the statute book in Scotland, Wales and Northern Ireland?
It is not entirely clear how this will work, although the government says it will work closely with the devolved administrations.
It also predicts the repeal process will result in a "a significant increase in the decision-making power of each devolved administration", as powers in devolved areas are repatriated from Brussels.
But the bill has been described by the Scottish government as an "executive power grab".
Ministers have confirmed the devolved administrations will be asked to consent to the bill - but this does not amount to a veto.
The UK government has warned that blocking the bill could have "very significant consequences", leaving "a hole in our law".