Media playback is unsupported on your device Media caption David Davis defends 'repeal bill' plans

The Scottish and Welsh governments have threatened to block the key Brexit bill which will convert all existing EU laws into UK law.

The repeal bill, published earlier, is also facing opposition from Labour and other parties in the Commons.

Ministers are "optimistic" about getting it through and have promised an "ongoing intense dialogue" with the devolved administrations.

No 10 said it had to be passed or "there will be no laws" after Brexit.

Brexit Secretary David Davis called it "one of the most significant pieces of legislation that has ever passed through Parliament".

He rejected claims ministers were giving themselves "sweeping powers" to make changes to laws as they are repatriated.

It will be up to MPs if they want a say on the "technical changes" ministers plan to make to legislation, he told the BBC.

Labour says it will not support the bill in its current form and is demanding concessions in six areas, including the incorporation of the European Charter of Fundamental Rights into British law.

The party wants guarantees workers' rights will be protected and also want curbs on the power of government ministers to alter legislation without full parliamentary scrutiny.

Leader Jeremy Corbyn, who was in Brussels earlier for a meeting with the EU's chief negotiator Michel Barnier, said: "Far too much of it seems to be a process where the government... will be able to bypass Parliament.

"We will make sure there is full parliamentary scrutiny. We have a Parliament where the government doesn't have a majority, we have a country which voted in two ways on Leave or Remain.

"The majority voted to leave and we respect that, but they didn't vote to lose jobs and they didn't vote to have Parliament ridden roughshod over."

The repeal bill

Formally known as the European Union (Withdrawal) Bill, the draft legislation is a key plank of the government's Brexit strategy

The first line of the bill says the European Communities Act 1972, which took Britain into the EU, will be "repealed on exit day"

This will end the supremacy of EU law and stop the flow of new regulations from Brussels

But all existing laws derived from the EU will continue to be in force - they can be changed or scrapped by further legislation

The bill does not detail policies line-by-line but transfers all regulations into domestic law

It gives the UK two years after Brexit to correct any "deficiencies" arising from the transfer

The Conservatives are relying on Democratic Unionist Party support to win key votes after losing their Commons majority in the general election, but could face a revolt from Remain supporting backbenchers.

BBC political editor Laura Kuenssberg said there could be "parliamentary guerrilla warfare" on the bill, as opposition parties and "Remainer Tories" try to "put their version of Brexit, not Theresa May's, on to the statute book".

The repeal bill is not expected to be debated by MPs until the Autumn, but will need to have been passed by the time the UK leaves the EU - which is due to happen in March 2019.

But the Scottish and Welsh governments have to give "legislative consent" to the bill before it can become law - something they have said they are not willing to do.

In a joint statement, first ministers Nicola Sturgeon and Carwyn Jones, who also met Mr Barnier, described the bill as a "naked power-grab" by Westminster that undermined the principles of devolution.

They say the bill returns powers from Brussels solely to the UK government and Parliament and "imposes new restrictions" on the Scottish Parliament and the Welsh Assembly.

Image copyright EPA Image caption Jeremy Corbyn presented Michel Barnier with an Arsenal shirt

Ministers at Holyrood will not be able to amend EU rules in devolved areas such as agriculture and fisheries after Brexit until the UK Parliament and Scottish government have reached an agreement on them.

UK Scottish Secretary David Mundell claimed the repeal bill would result in a powers "bonanza" for Holyrood - a comment described as "ludicrous" by the SNP.

Theresa May's official spokeswoman said the repeal bill was a "hugely important piece of legislation" because "we need to have a functioning statute book on the day we leave the EU".

The spokesman said First Secretary of State Damian Green had contacted the devolved administrations in Scotland, Wales and Northern Ireland and the government was confident of gaining their consent.

Asked if there was a contingency plan if he didn't win their backing, the prime minister's official spokesman said "not that I'm aware of".

Lib Dem leader Tim Farron, whose party is seeking to join forces with Labour and Tory rebels, said he was "putting the government on warning", promising a tougher test than than it faced when passing legislation authorising the UK's departure from the EU.

"If you found the Article 50 Bill difficult, you should be under no illusion, this will be hell," he said.

Steve Baker, a minister in the Department for Exiting the European Union, said the government was "ready" for a fight over the bill but would also to "listen to Parliament".

Speaking to BBC political editor Laura Kuenssberg, Mr Davies predicted the bill "may get amendments here and there", saying he was open to suggestions from other parties for things that should be included.

"If we've missed something and got something wrong, then we'll debate that in the House of Commons," he said.

"That's how this works."

Mr Davis also insisted contingency plans were being made in case the UK and the EU cannot agree a Brexit deal.

"We are planning for all options," he said.

"The ideal outcome... right through to it not working at all and not getting a negotiated outcome at all."

Asked why Foreign Secretary Boris Johnson had said the government had "no plan" for such a scenario, he said: "That's possibly because it's my responsibility to plan for it."