The UK Government has confirmed that it will refer the Welsh Government’s Brexit law to the highest court in the country.
Judges in the Supreme Court will decide if the Continuity Bill can become law.
It was passed by AMs in March to hand Welsh ministers EU powers in devolved areas after Brexit.
Welsh Secretary Alun Cairns has said the action was aimed at giving legal clarity. The Welsh Government said it would defend its bill.
Finance Secretary Mark Drakeford said the Welsh Government would defend its bill “to the full”.
Discussions are ongoing between the two governments about what happens to powers in devolved areas after the UK leaves the European Union.
Mr Cairns said he was “optimistic” agreement would be reached on the return from Brussels of 64 powers in devolved areas.
Under the latest proposal from the UK Government, the vast majority of those devolved powers in areas such as agriculture support and food labelling will go to Cardiff, Edinburgh and Belfast after Brexit whilst the rest will be held temporarily in London.
But the Welsh and Scottish governments have said those proposals amount to a “power-grab” and that UK-wide frameworks should be agreed by consensus.
The Attorney General, Jeremy Wright, said: “This legislation risks creating serious legal uncertainty for individuals and businesses as we leave the EU.
“This reference is a protective measure which we are taking in the public interest. The government very much hopes this issue will be resolved without the need to continue with this litigation.”
The Welsh Government said it would defend “any action before the Supreme Court”.
Its spokeswoman said: “We have always said our preference is for a UK-wide Withdrawal Bill, which respects devolution and we continue to work with the UK Government to achieve this.
“In the meantime, our Bill is a legitimate means of protecting Welsh interests and devolution settlement.”
Welsh Conservative Leader Andrew RT Davies said: “We don’t think that the Welsh Labour Government has adopted the right approach.
“In particular, the way the bill was put through the assembly. I think stage 2 was completed within 40 minutes and stage 3 most probably a little shorter time than that.
But he said he was “very pleased” with the progress made in the discussions between the UK, Welsh and Scottish government on changes to the EU Withdrawal Bill.
Plaid Cymru AM Bethan Sayed said: “We believe that it’s quite drastic for the UK Government to go to the Supreme Court just to verify the process.
“They’re using light words but it seems quite an extreme action to take in this regard.
“It does create a mockery of joint-working to take it to this level. If it’s not a power-grab, why take us to court?”