The UK government’s law officer for Scotland, Lord Keen, has offered his resignation to the prime minister.
BBC Scotland understands the advocate general has found it difficult to reconcile plans to override the Brexit withdrawal agreement with the law.
Lord Keen’s resignation has not yet been accepted by Downing Street.
BBC Scotland chief political correspondent Glenn Campbell said there appeared to be an effort to persuade the law officer to remain in the post.
The government’s most senior lawyer – Sir Jonathan Jones, permanent secretary to the government legal department – has already resigned over the legislation, which passed its first parliamentary test on Monday.
PM’s Brexit bill clears first hurdle in Commons
The row centres on the UK government’s Internal Markets Bill, which Northern Ireland Secretary Brandon Lewis told MPs could “break international law” by overriding the withdrawal agreement signed with the EU.
Lord Keen subsequently argued in the House of Lords that his view was that “the bill does not of itself constitute a breach of international law or of the rule of law”.
He said that Mr Lewis had “essentially answered the wrong question”.
But the Northern Ireland secretary has since doubled down, saying that his statement was a “very straight answer” which was “absolutely in line” with legal advice.
Media captionBrandon Lewis says he gave the “correct” answer when he was asked if the Internal Market Bill would break international law.
BBC Political Editor Laura Kuenssberg said Lord Keen’s resignation had been rumoured for days, and had ultimately happened “after Brandon Lewis contradicted him this morning”.
Richard Keen had been the chairman of the Scottish Conservatives until being appointed as Advocate General in 2015 – when he was also made a life peer as Baron Keen of Elie.
The QC has represented the UK government in court in a number of high-profile cases, including over the prorogation of parliament in 2019 and the “Article 50” Brexit case in 2016-17.
As a law officer in the UK government, Lord Keen has been defending plans to give ministers powers to change the EU withdrawal agreement in the event that the two sides can’t agree a trade deal.
He has argued that while this part of the UK internal market bill creates tension with the UK’s international obligations, that is not unprecedented and that domestic law should prevail.
The trouble is, the Northern Ireland Secretary Brandon Lewis has already said that overriding the Brexit divorce deal would break international law in a “very specific and limited way” and he’s rejected Lord Keen’s suggestion that he’d answered incorrectly.
That’s made it increasingly difficult for Lord Keen to reconcile the government’s plans with the law and he wrote to the prime minister on Wednesday morning offering his resignation.
That was not immediately accepted and the government appeared to be making efforts to persuade him to stay.
Lord Keen would be the first member of the government to quit over its approach to this issue, which has drawn criticism from former attorneys general and all five former prime ministers.
What is the Internal Markets Bill?
The bill sets out rules for the operation of the UK internal market – trade between England, Scotland, Wales and Northern Ireland – after the end of the Brexit transition period in January.
No new checks on goods moving from Northern Ireland to the rest of Great Britain
Giving UK ministers powers to modify or “disapply” rules relating to the movement of goods that will come into force from 1 January if the UK and EU are unable to reach an alternative agreement through a trade deal
Powers to override previously agreed obligations on state aid – government support for businesses
The bill explicitly states that these powers should apply even if they are incompatible with international law.
Ministers say the legislation is needed to prevent “damaging” tariffs on goods travelling from the rest of the UK to Northern Ireland if negotiations with the EU on a free trade agreement fail.
But some senior Conservatives – including former Prime Minister John Major – have warned it risks undermining the UK’s reputation as an upholder of international law.
The legislation has also proved controversial with the devolved administrations, which are concerned about how the UK’s “internal market” will operate post-Brexit and who will set regulations and standards.
Media captionLeyen: UK and EU “jointly agreed” on withdrawal agreement
Meanwhile, European Commission President Ursula van der Leyen has warned the UK cannot unilaterally set aside the withdrawal agreement.
She said on Wednesday the agreement was the only way to guarantee the Northern Ireland peace process, and warned that its replacement would undermine trust in the UK.
PM defends planned Brexit deal changes
What is the Withdrawal Agreement Bill?
Last week marked the start of the eighth round of post-Brexit trade deal talks between the UK and the EU.
The two sides are trying to secure a deal before the end of the transition period on 31 December, which will see the UK going onto generic World Trade Organisation rules if no agreement is reached.