The Court of Appeal has thrown out the Welsh Government's legal challenge to the UK's cornerstone legislation to replace EU standards within the UK.
The Welsh Government said it planned to appeal to the Supreme Court against the decision by three senior judges sitting on the Court of Appeal.
Ministers in Cardiff Bay had argued that the UK's new Internal Market Act was incompatible with some of their rights to make laws on issues it covered. However the judges ruled that this could only be tested in connection with a specific law the Welsh Governement wanted to make.
Welsh Secretary Simon Hart, a member of the UK cabinet, criticised ministers in Cardiff Bay, calling it a "waste of time and money".
The act was drawn up after the Brexit transition period, and Boris Johnson's government said it wanted to avoid different regulations in the four nations once EU rules no longer applied. But, when Senedd members voted on it, they opposed the act saying it would would centralise power in London and could result in lower food standards or environmental protection in Wales.
When then-Counsel General Jeremy Miles announced the legal action in January 2021, he argued it "severely curtails" the powers of the Senedd and could prevent it from making laws on food or environmental standards but his request for the High Court to allow the case to proceed to a full hearing was rejected as premature.
In the earlier hearing, Lord Justice Lewis, sitting with Mrs Justice Steynm said it was "inappropriate to seek to address such issues in the absence of specific circumstances giving rise to the arguments raised by the claimant and a specific legislative context in which to test and assess those arguments".
The Court of Appeal has now upheld that ruling.
On Wednesday Lady Justice Nicola Davies, sitting with Master of the Rolls Sir Geoffrey Vos and Lord Justice Dingemans, said: "The claimant has indicated potential areas of concern in relation to food standards and environmental protection.
"Again, until legislation is proposed in relation to food standards, it will not be clear whether that proposed legislation, properly interpreted, falls within a reserved matter or an exception to it.
"Similarly, in relation to proposed environmental legislation, such as restrictions on the use of single use plastic, the issues that arise are likely to be influenced by the precise terms of the legislation and the context in which it is made. They will frame the issues that arise.
"For that reason alone, it is better and more appropriate for the issues concerning the effect of the provisions of the UK Internal Markets Act on the legislative competence of the Senedd, and the appropriate means of resolving any conflict between the two, to be considered in the specific legal and factual context of particular provisions of proposed Senedd legislation rather than by making abstract rulings shorn of any legal or factual context."
A Welsh Government spokesperson said: "We are disappointed with the judgement and will continue to take all possible steps to challenge the UK Internal Market Act. We note that the Court has not rejected our concerns, but rather expressed a preference for testing the issues against a specific piece of Senedd legislation
"We will continue to champion the rights of the Senedd to legislate without interference in areas devolved to Wales.
"With this in mind, the Counsel General has applied for permission to appeal this matter to the Supreme Court. It is hoped that such an appeal will help to resolve this issue of continued constitutional importance."
Conservative Welsh Secretary Simon Hart tweeted: "The right outcome, but extraordinary amounts of money & time wasted. The UKIM Act protects internal trade within the UK, thousands of jobs in Wales.
"Questionable as to why Welsh Government would waste time & resource challenging this with so many other pressing issues. Interesting comments in the judgement highlighting that Welsh Gov were happy for the EU to hold powers contained in UKIM, but are now questioning why they should be exercised UK-wide. We now need to move forward to make the most of post-Brexit opportunities in Wales."
To get the latest email updates from WalesOnline click here.