Image copyright Getty Images Image caption The future of the border between Ireland and Northern Ireland is deeply controversial on both sides of the Irish Sea

The UK government unveiled its draft Brexit agreement with the EU earlier this week - and faced an immediate backlash over its "backstop" proposals for the Irish border.

Several government ministers who resigned in protest over the deal - including Brexit secretary Dominic Raab - said the backstop threatens the existence of the United Kingdom.

And Scotland's first minister has predicted it will have a devastating impact on the Scottish economy.

So what's all the fuss about?

Why is the backstop needed?

It's there to make sure that there are no customs, regulatory or VAT barriers which would mean that goods have to be checked as they cross the Irish border.

If a trade deal is struck which gives the whole of the UK deep access to the single market the backstop would not be needed and Northern Ireland would be no different or better off than Scotland or anywhere else in the UK.

Alternatively there could be a looser relationship between the EU and the whole of the UK, including Northern Ireland, but technical fixes would keep the Irish border frictionless.

That's the preferred option for many Brexit supporters but has been repeatedly dismissed as unworkable by the EU.

So if the trade deal or the technical fix aren't enough then the backstop would kick in.

What would it actually do?

Image copyright Getty Images Image caption The backstop guarantees that Northern Ireland businesses can continue to place products on the EU's internal market without restriction

It would mean Northern Ireland would align with the EU single market on goods standards, agricultural production and veterinary controls.

The whole of UK would form a single customs territory with the EU but Northern Ireland alone would follow the full EU customs code.

Northern Ireland businesses could then get their goods into the single market in essentially the same way they do today.

That is spelled out in guidance notes from the European Commission: "Under the backstop and in order to avoid a hard border, Northern Ireland businesses can place products on the EU's internal market without restriction."

For the rest of the UK, including Scotland, the less comprehensive customs arrangement would have implications as the Commission guidance again explains.

It says: "Placing goods on the internal market that come from outside of Northern Ireland requires that the processes provided for in the Union Customs Code will have to be applied."

Those processes would mainly involve additional administrative burdens. But that is just customs. There are also major issues concerning EU standards on goods.

What would it mean in practice?

Media playback is unsupported on your device Media caption BBC News NI's political reporter Jayne McCormack explains why the border is an issue

In a backstop situation Northern Ireland would align with EU standards, the rest of the UK would not.

The most onerous standards concern food and agricultural products, so conceivably 100% of Scottish food shipments going into the EU would require documentary and physical checks.

Northern Ireland products would just sail through as they do today.

However the flipside of this is that because Northern Ireland would effectively be in the EU single market for goods there would have to be checks and controls on some products coming in from elsewhere in the UK.

That could mean supermarket lorries being checked as they come off the ferries into Northern Ireland, but Scotland would face no such restrictions on internal UK trade.

Why is it particularly controversial in Scotland?

Image copyright Getty Images Image caption Nicola Sturgeon is worried about the backstop's potential impact on the Scottish economy

Nicola Sturgeon, the Scottish first minister, is strongly opposed to Brexit - and the country voted by 62% to 38% to remain in the EU.

She has argued that if the whole of the UK cannot remain in the single market and customs union after Brexit, then a deal should be struck that allows Scotland to do so.

The UK government is now having to explain why it was impossible to make Scotland a special case - while at the same time agreeing separate arrangements for Northern Ireland.

It points out that Northern Ireland shares a physical border with the EU, which Scotland does not, and says the backstop is needed to protect the Good Friday peace agreement.

But Ms Sturgeon says the backstop would give Northern Ireland a competitive advantage by offering businesses easier access to the single market, which she fears would have a "devastating" impact on Scottish jobs and investment.

Conservative critics of the backstop believe it is a political gift for Ms Sturgeon, who they fear will use it to spearhead a fresh drive for Scottish independence.

When he resigned as the UK government's Brexit secretary on Thursday, Dominic Raab said the backstop was a "very real threat to the integrity of the United Kingdom".

Scottish Secretary David Mundell and Scottish Conservative leader Ruth Davidson are also under pressure after previously warning the prime minister they could not back any deal that "delivers a differentiated settlement for Northern Ireland".