Image copyright Supreme Court Image caption Advocate General for Scotland Lord Keen is leading for the UK government side in the case

Holyrood's Brexit bill is "fundamentally inconsistent" with UK law and should not be allowed to stand, judges at the Supreme Court have heard.

The court is hearing arguments about whether the Brexit legislation passed by MSPs should be allowed to stand.

UK law officer Lord Keen said the Scottish legislation would "undermine" Westminster's EU Withdrawal Bill.

But Scotland's Lord Advocate insists that the bill is within Holyrood's remit and should become law.

The hearing will continue on Wednesday, and a judgement is not expected until later in the year.

The Welsh and Northern Irish assemblies will also be represented in the two-day hearing, having made submissions backing the Scottish government's stance.

The UK Withdrawal from the European Union (Legal Continuity) (Scotland) Bill - known as the "continuity bill" - was passed under emergency procedures with only the Conservatives and a single Lib Dem MSP voting against it.

It was drafted as an alternative to Westminster's EU Withdrawal Bill, which MSPs refused to give their consent to following a row over how powers currently exercised from Brussels will be used after Brexit.

But before it could become law, it was referred to the Supreme Court by UK law officers to settle whether it lies within Holyrood's competence.

Presiding Officer Ken Macintosh penned an official memo saying the bill was "not within the legislative competence of the parliament", as it would see MSPs "make provision now for the exercise of powers which is it is possible they will acquire in future".

This was denied by Lord Advocate James Wolffe, the Scottish government's top legal adviser, who insisted the legislation was "carefully framed" not to cut across EU laws - and said it was designed on the Withdrawal Bill in that regard.

The UK government's senior law officers said they wanted the Supreme Court to look at the bill to ensure there was "legal certainty" about whether it is valid.

Image copyright Supreme Court Image caption Seven Supreme Court justices will hear two days of arguments about the Brexit bill

Arguments are being heard at the Supreme Court by Lady Hale, Lord Reed, Lord Sumption, Lord Carnwarth, Lord Hodge, Lord Kerr and Lord Lloyd-Jones.

Lord Keen, the Advocate General for Scotland, opened the first day of the hearing arguing that the Scottish bill is "fundamentally inconsistent" with the Withdrawal Bill passed by MPs.

The Holyrood bill includes several provisions not mirrored in the Westminster one, such as retaining the EU's Charter of Fundamental Rights and giving ministers the power to suggest EU laws to "keep pace" with even after Brexit.

'Cannot stand'

Lord Keen said it was "perfectly clear" that the Scottish bill was "directly inconsistent with the UK Act at the most basic of levels", saying "the two simply cannot stand together".

He told the court that this would create "dual and inconsistent regimes" within the UK, which would "directly frustrate the purpose" of the Withdrawal Bill, which was to create a "single cohesive body" of EU laws retained after Brexit.

He also argued that the continuity bill could have a bearing on international relations, a field reserved to the UK parliament. He said that "withdrawal from the EU is a matter for the UK parliament, and the devolved administrations do not have a parallel legislative competence" in this area.

His written argument stated: "The effect of what the Scottish bill does is to make provision for the future relationship with the EU and EU law when that relationship is under negotiation. That could serve to undermine the credibility of the UK's negotiating and implementation strategy in the eyes of the EU."

Image copyright Supreme Court Image caption Lord Advocate James Wolffe will continue his submissions to the court on Wednesday

The Lord Advocate also began his submissions on Tuesday afternoon, arguing that Holyrood was not specifically barred from legislating on Brexit.

He said the Advocate General had drawn too broad a definition of international relations, adding: "I say the bill, given it has effect only in the domestic legal order, cannot affect the UK's negotiations with the EU."

He noted that the Withdrawal Bill had not been passed into law at the time the continuity bill was passed, saying that the existence of a UK bill was "irrelevant to the questions of legislative competence".

Mr Wolffe's written submission also accuses UK law officers of an "erroneous analysis of the legal consequences of withdrawal from the EU".

And he noted that Westminster has the power to "amend or indeed repeal the Scottish bill", but has not moved to do so. He said that "any uncertainty, confusion or ambiguity arising from the presence on the statute book of these two bills will be consequence of that legislative choice".

Interested parties

The bulk of Mr Wolffe's arguments will be heard on Wednesday.

After that, judges will also hear from the counsel general for Wales and the Northern Irish attorney general, who have made submissions as interested parties.

Both have backed the Scottish government's view that Holyrood should be allowed to legislate on Brexit.

The Welsh government originally had a Brexit bill of its own, which also faced a court challenge, but the legislation was withdrawn after ministers came to an agreement with UK counterparts over the Withdrawal Bill.

The three options open to the judges are to give the bill the green light, to reject it entirely, or to allow some sections to stand while rejecting others.

Should any part of the bill be struck down, it would go back to Holyrood for MSPs to consider making changes.

Image copyright PA Image caption The ruling could have big implications for Scotland's relationship with the EU and with the UK

The Scottish and UK governments have been unable to agree on how powers currently exercised from Brussels are to be used after the UK leaves the EU in March 2019.

Both sides agree that certain powers should be used to set up UK-wide frameworks of common rules and regulations, in fields like food standards and labelling. But ministers cannot agree on who should have the final say over how this should be done.

Scottish ministers say giving Westminster the final say is a "power grab" from Holyrood, while Whitehall ministers say they cannot give MSPs a "veto" over UK-wide plans.

With the dispute deadlocked, MSPs refused to give their consent to the EU Withdrawal Bill, giving fresh importance to the issue of the continuity bill and whether it will be allowed to stand.

The Scottish government has also indicated that it will not put any of the UK government's further Brexit legislation forward for consent votes at Holyrood until the row has been resolved.