Image caption Labour's Carwyn Jones is working with the SNP to block the bill

Theresa May has been warned of an "immense constitutional crisis" if she goes ahead with a key Brexit bill without devolved governments' consent.

Welsh First Minister Carwyn Jones said the repeal bill, to convert current EU laws into UK law, was a "naked power-grab" which he could not support.

He has joined forces with SNP leader Nicola Sturgeon to opposed the bill, which ends the supremacy of EU law.

Downing Street says it is "optimistic" of getting the bill into law.

But the prime minister also faces a battle at Westminster, when MPs debate it in the autumn, with Labour promising to vote against it in its current form.

Labour leader Jeremy Corbyn is demanding concessions in six areas, including the incorporation of the European Charter of Fundamental Rights into British law and guarantees workers' rights will be protected.

Media playback is unsupported on your device Media caption Carwyn Jones: "I think it is possible to retrieve the situation"

The bill needs to be passed by the time the UK leaves the EU - which is due to happen in March 2019 - otherwise the UK will be left with no laws in areas previously covered by EU-derived statutes.

Brexit Secretary David Davis rejected claims ministers were giving themselves "sweeping powers" to make changes to EU laws as they are repatriated - as Labour and the SNP claim - and he is willing to "work with anyone" to get the repeal bill into law.

He has also claimed that no powers currently exercised by the devolved administrations will be removed, in a bill which he says is mainly "technical" in nature.

Could Scotland and Wales block repeal bill?

By Peter Barnes, senior political analyst

Westminster normally seeks the consent of the Scottish Parliament and Welsh Assembly when it passes UK-wide laws that cover devolved issues - as the repeal bill will.

This is what's known as the Sewel Convention - named after Lord Sewel who first set it out when the Scottish Parliament was established.

However, it's a political convention, not a legally enforceable rule.

That remains true even though it has been given a statutory basis in the Scotland Act 2016 and Wales Act 2017.

The Supreme Court made this clear in its judgment in the case brought by Gina Millar about triggering Article 50.

So it's not absolutely essential to have Scotland and Wales's consent.

But it will be highly contentious if the UK government pushes the bill through against the wishes of the Scottish and Welsh governments.

Reality Check: Can Scotland and Wales block the repeal bill?

But in a joint statement on Thursday, first ministers Nicola Sturgeon and Carwyn Jones said they couldn't support the bill as it stood, arguing it would return powers solely to the UK government and Parliament and "impose new restrictions" on the Scottish Parliament and the Welsh Assembly

Speaking on Friday, Carwyn Jones said the UK government could not be trusted to keep its promise to hand powers back to Cardiff and Holyrood after Brexit.

Asked whether it was not the case that, legally, the UK government could go ahead with the bill anyway, he told BBC Breakfast. "If they did that...there would be an immense constitutional crisis because it would go against everything the UK is based on.

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

"It would also mean all the words they have used so far are worthless. David Davis and Boris Johnson have both said the consent of the devolved Parliaments will be needed so their words are absolutely worthless and they are prepared to override something that has been in place for 18 years."

But he later struck a more conciliatory tone, telling an assembly committee meeting that Welsh Secretary Alun Cairns had assured him that they would work together "to make the situation acceptable" and it was possible to "retrieve" matters.

Mr Cairns said he was taken aback by the criticism as the Welsh government had been involved in drafting the repeal bill.

A Downing Street 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.

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.

Conservative MP Kwasi Kwarteng, a ministerial aide to Chancellor Philip Hammond, conceded the passage of the bill would be "difficult" but downplayed newspaper reports claiming more than a dozen Tory MPs could rebel over aspects of the legislation.

He told the BBC's Daily Politics the government was "more united" than commentators were assuming and there were also Labour MPs sympathetic to its position.

Outgoing 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 "if you found the Article 50 Bill difficult, you should be under no illusion, this will be hell," he said.

But Mr Kwarteng said Mr Farron has "his own agenda" and was "not really in a position to talk about guerrilla warfare" as he had quit after failing to make real headway in the general election.