Theresa May’s draft Brexit agreement has been agreed by her cabinet after more than 18 months of negotiations with the EU.
It took five hours of discussions inside Downing Street before the prime minister was able to hail the “decisive step”.
The Conservative Party has had a string of high profile resignations over Brexit, and it is understood around 10 ministers were opposed to Mrs May’s draft deal.
Sky News breaks down the key points from the 585-page document:
:: UK will be a “single customs territory” from March 2019 until December 2020
:: UK to remain in EU customs union indefinitely if new agreement not reached by then
:: Northern Ireland to be in same customs territory as UK and EU if no future agreement made
:: EU nationals living in UK for five years in a row to have right to stay permanently in UK with families
:: UK will not be obliged to give student grants or loans to non-permanent residents
:: End of free movement – but visa-free travel to EU countries will continue
:: UK to become “independent coastal state” but will work with EU on fishing rights.
The draft agreement states the UK and the EU want to “establish ambitious” arrangements in this area in their “close future relationship”.
It adds there will be a “single customs territory” until the end of the transition period on 31 December 2020.
The UK will remain in a customs union with the EU indefinitely if a new trade agreement is not reached in that time.
Maintaining such an agreement has served as a measure to avoid a hard border on the island of Ireland.
Irish Prime Minister Leo Varadkar said the issue has been “one of the most difficult challenges” of the negotiations.
He said a backstop will remain in place “unless and until” a better solution is agreed.
Michel Barnier, the EU’s chief negotiator, has said a trade deal between the UK and EU is possible by the end of 2020.
The document details plans for what a backstop for the Irish border would look like – though it notes that neither side wants this outcome.
It would involve Northern Ireland being in the same customs territory as the rest of the UK, and the EU.
This would involve level playing field commitments to ensure trade in goods between the UK and the EU is based on fair principles.
But it would also mean different regulations for Northern Ireland – more EU law in agriculture, the environment, state aid and other areas.
There would also be checks on goods traded from Northern Ireland to the rest of the UK.
Enforcing those laws will mean an EU presence: EU representatives will be present to enforce and implement the law relating to Northern Ireland, and the UK will have to facilitate their work and carry out necessary control measures.
The document states that the EU and the UK will use their “best endeavours” to come to a future trade agreement to avoid the backstop, and notes the transition period can also be extended.
Otherwise, it could be tricky to get out of the backstop.
One party would need to apply to the other to end it, and an exit would have to be decided by the joint commission by the top decision makers from the EU and UK.
The document lays out rights for EU nationals living in the UK and vice versa.
EU nationals who have lived in the UK continually for five years, and Brits who have lived in EU countries, will have the right to stay permanently in the UK, along with their family members.
They will “enjoy equal treatment with the nationals of that state” and so will their family members.
However, there are limitations on this: the host state will not be obliged to “confer entitlement to social assistance” in certain areas, and it will not be obliged to give student grants or loans to people who do not yet have permanent residence.
The deal also means the end of free movement, though there will be visa-free travel to EU countries.
The UK has said it will work “bilaterally” with the EU but will become “an independent coastal state”.
The draft deal says the UK will be “consulted” on “fishing opportunities” and invited to comment regularly on the EU’s fishing policies.
A committee will be set up between the UK and Spain for “regular discussion between the competent authorities” in relation to Gibraltar.
Scotland Secretary David Mundell has given his backing to the draft Brexit deal, claiming it will deliver for the fishing industry.
All 13 Scottish Conservative MPs said they would not support an agreement which would prevent the UK from independently negotiating access and quota shares.
Mr Mundell said: “I was content to move to the next stage of the process on the basis that Brexit will deliver for our fishing industry – as I and colleagues set out in our letter – and on the basis that arrangements for Northern Ireland will not undermine the economic or constitutional integrity of the UK.
“I hope there will be agreement at the European Council later this month and we can move to a vote in parliament.
“The worst possible outcome for Scotland and the whole of the UK would be a no-deal departure from the EU.”
What have the UK and EU leaders said?
Theresa May, UK prime minister
Mrs May said the agreement was the result of “thousands of hours of hard negotiation”.
“When you strip away the detail, the choice before us is clear,” she said.
“This deal which delivers on the vote of the referendum, which brings back control of our money, laws and borders; ends free movement; protects jobs, security and our union; or leave with no deal; or no Brexit at all.
“I know that there will be difficult days ahead. This is a decision which will come under intense scrutiny and that is entirely as it should be and entirely understandable.
“But the choice was this deal, which enables us to take back control and to build a brighter future for our country, or going back to square one with more division, more uncertainty and a failure to deliver on the referendum.”
Arlene Foster, Democratic Unionist Party leader
There was much in the agreement that the DUP may have felt unhappy about.
Arlene Foster tweeted a curt response a few hours after the big reveal: “We had a frank meeting tonight with the Prime Minister lasting almost an hour. She is fully aware of our position and concerns.”
Michel Barnier, EU chief negotiator
Mr Barnier hailed the agreement as a crucial step in concluding the negotiations.
He stressed that the draft had found a solution to avoid a hard border on the island of Ireland.
“Much work needs to be done, the road is still long and it may be difficult to get an orderly Brexit,” he said.
Leo Varadkar, Republic of Ireland prime minister
The Irish leader said Ireland will continue with its priorities: protecting the peace process, protecting trade, jobs and the economy, and keeping Ireland in the EU.
He said today had brought a satisfactory result to those aims.
“Our analysis has always shown that Brexit will be bad for Ireland, therefore our approach has always been to seek to minimise the harmful impacts of Brexit on Ireland and to maximise any opportunities, no matter how few.”
(c) Sky News 2018: Brexit draft deal: The key points explained