Image copyright Getty Images Image caption Sources have told the BBC Ms Davidson and Mr Mundell have made it clear they would resign if Northern Ireland faces new controls that separate it from the rest of the UK

Scots Tory leader Ruth Davidson and Scottish Secretary David Mundell could resign from their roles over a possible Brexit compromise, BBC sources say.

In a letter to the prime minister they said they would not support any deal that introduces different arrangements for Northern Ireland.

They said this would "undermine the integrity" of the UK.

Scotland's Brexit Minister Mike Russell said it was "an astonishing development".

Sources have told the BBC Ms Davidson and Mr Mundell have made it clear they would resign if Northern Ireland faces new controls that separate it from the rest of the UK - because that could fuel the case for Scottish independence.

A source close to Mr Mundell told the BBC: "If you find yourself not agreeing with government policy" resigning would be the "logical outcome". A source close to Ms Davidson said the issue was a "red line".

In the letter to Theresa May, the Scottish Tory leader and Scottish Secretary said: "Having fought just four years ago to keep our country together, the integrity of our United Kingdom remains the single most important issue for us in these negotiations.

'Any deal that delivers a differentiated settlement for Northern Ireland beyond the differences that already exist on all Ireland basis (eg agriculture), or can be brought under the provisions of the Belfast Agreement, would undermine the integrity of our UK internal market and this United Kingdom.

It added: "We could not support any deal that creates a border of any kind in the Irish Sea and undermines the Union or leads to Northern Ireland having a different relationship with the EU than the rest of the UK, beyond what currently exists."

The Scottish government's Constitutional Relations Secretary Mike Russell told the BBC's Sunday Politics Scotland programme: "This is an astonishing development, not that Ruth Davidson holds any position in the UK government, but to say that you'll resign if Scotland is not treated as badly as everywhere else strikes me as a complete dereliction of duty.

"They're elected by people in Scotland and here they want Scotland to suffer the hardest of Brexits. That strikes me as a ludicrous position and one in which we should be saying, have they really come to this?"

What is the Chequers plan? At the beginning of the summer the government's senior ministers held a day-long meeting about Brexit at Chequers, the prime minister's official country home in Buckinghamshire. The aim was to agree what the government wanted from negotiations with the EU about the future relationship between the UK and the EU over Brexit. The plan that emerged from the meeting has become known as the Chequers plan, or sometimes simply Chequers. The key aim of the plan is to create a free-trade area for goods moving between the EU and the UK while stopping freedom of movement for people between them. To do this, the UK would commit to collecting import taxes, known as tariffs, on behalf of the EU for goods that arrive in the UK on their way to the EU. Meanwhile, goods that were staying in the UK could be charged at a different rate, depending on any future trade deals the UK agrees with other countries. The UK would also agree to a "common rulebook" with the EU for manufactured goods and food, which would mean following EU rules and standards. In the future, if the EU changed any of its standards, the UK could decide not to follow those changes but at the risk of losing the free trade agreement for those goods. The government believes the combination of the common rulebook and collecting tariffs for the EU would avoid the need for checks on goods passing between the UK and the EU, including over the Irish border. However, the EU doesn't accept all proposals in the Chequers plan. It thinks the proposals amount to "cherry-picking" parts of EU membership - in other words, keeping the bits the UK wants to stay attached to, while rejecting other rules. The EU is also unconvinced the UK would be able to accurately track all the goods moving through it.

First Minister Nicola Sturgeon tweeted: "We'll resign if you do anything that makes Scotland think there's a better alternative to a hard Tory Brexit' say Mundell and Davidson!

"First, what a bizarre position - isn't it their job to stand up for Scotland? And, second, have they the gumption to resign? I bet they don't!"

Labour MP Ian Murray tweeted: "But they also don't want to continue to participate in the customs union and single market so how do they suggest resolving it? Utterly contemptible.

"They can't achieve a no hard border in Ireland without participation in the same trading arrangements as the EU."