Britain and the European Union struck a divorce deal on Friday that paves the way for arduous talks on future trade ties, easing immediate pressure on Prime Minister Theresa May and boosting hopes of an orderly Brexit.
May rushed to Brussels before dawn to seal a European Commission agreement that "sufficient progress" had been made to begin talks about trade and a two-year Brexit transition period that will start when Britain leaves the EU on March 29, 2019.
Negotiators in London, Brussels and Dublin worked through the night before breaking an impasse over the status of the Irish border, the last major obstacle to the opening of trade talks which EU leaders are due to bless at a summit on Dec. 15.
But though the Irish prime minister called a British pledge to avoid a destabilising "hard border" for Northern Ireland a "bullet-proof" commitment, one senior EU official conceded that wording to appease May's Belfast allies was a "fudge" which had simply put off until later the need to "square the circle".
While Northern Ireland would remain aligned with the rules of the EU's single market and customs union under which member state Ireland operates, May's government is officially committed to leaving both the single market and customs union.
Actual negotiations on a trade pact that may take several years to agree may not start for some months. But EU officials said they should be ready to start rapid talks in January to give May the transition period she wants to reassure business that not much will change for a couple of years after Brexit.
Speaking before sunrise at the EU executive's headquarters after a hurried flight on a Royal Air Force plane, May said opening up trade talks would bring certainty for citizens and businesses about Britain's future after quitting the EU.
"The most difficult challenge is still ahead," European Council President Donald Tusk cautioned. "We all know that breaking up is hard. But breaking up and building a new relationship is much harder."
May, looking weary after just a couple of hours sleep, spoke after Commission President Jean-Claude Juncker announced the breakthrough, first in English and then in German and French.
The move to agree trade talks 18 months after the United Kingdom's shock vote to exit the EU allayed some fears of a disorderly Brexit that could disrupt trade between the world's biggest trading bloc and its sixth-largest national economy.
Sterling was dented when last-minute objections from Belfast forced May to abort a deal on Monday while already in Brussels, but it climbed to a six-month high against the euro on Friday. It later gave up earlier gains and turned lower on the day against the EU common currency as investors took profits after a sharp rally in recent days.
Facing 27 other members of the bloc, May largely conceded to the EU on the structure, timetable and substance of the negotiations.
Moving to talks about trade and a Brexit transition was crucial for May's own future after her premiership was thrown into doubt when she lost the ruling Conservative Party its majority in an unwisely called snap election in June.
"I very much welcome the prospect of moving ahead," said May, a 61-year-old Anglican vicar's daughter who herself voted to stay in the EU in the June 2016 referendum but has repeatedly insisted Britain will make a success of Brexit.
A senior British banker said the deal signalled May would stay in power for now and that Britain was heading toward a much closer post-Brexit relationship with the EU than many had feared.
Irish Prime Minister Leo Varadkar agreed. "...What phase one was always about was narrowing the parameters, and we are now funnelling and directing things into a situation where I believe the United Kingdom including Northern Ireland will remain in alignment with the EU on lots of regulations," he told Irish national broadcaster RTE on Friday evening.
Heralding pitfalls ahead, however, Scotland's leader Nicola Sturgeon swiftly cited the promise of free trade on the Irish border as removing an argument used to dissuade Scots from breaking their union with England to rejoin the European Union.
Draft guidelines showed the transition period, which would start on March 30, 2019, could last around two years, as May has requested. During that time, Britain will remain part of the EU's customs union and single market but no longer take part in EU institutions or have a vote.
It will also still be subject to EU law.
Pro-Brexit Conservative lawmakers rallied around her after the deal. This looked like a signal that the party, which has been split over EU membership for generations, was not preparing to ditch her immediately despite the election fiasco in June that left her government dependent on the support of Northern Ireland's Democratic Unionist Party (DUP).
British Foreign Secretary Boris Johnson, who spearheaded the 2016 Brexit campaign, congratulated May, adding that Britain would now take back control of its laws, money and borders.
Supporters of a radical Brexit were tougher.
Brexit campaigner Nigel Farage struck a jarring note saying it was extraordinary a British premier had conceded so much in the middle of the night, agreeing to all the demands of Juncker, Tusk and EU negotiator Michel Barnier.
"The British prime minister has to fly through the middle of the night to go and meet three unelected people, who condescendingly say: 'Now, jolly well done May, you've met every single one of our demands, thank you very much, we can now move on to the next stage'."
Asked for an example of the EU conceding something to London, which says it will pay 40-45 billion euros over many years to meet EU obligations, Barnier said Brussels dropped a demand that Britain bear relocation costs for two EU agencies that are leaving London - costs in the hundreds of millions.
Juncker once put the Brexit bill at some 60 billion euros ($70 billion) but Barnier said it was not possible to calculate a firm figure as much depended on future developments.
Jeremy Corbyn, the socialist leader of Britain's main opposition Labour party, said on Friday he wanted to see much more information about the divorce deal before he could judge whether it was a breakthrough.
Corbyn said Labour had consistently called for maintaining the benefits of belonging to the EU's customs union and single market during a transitional period as Britain leaves the bloc.
"The transitional period is unspecific and I think she needs to bring some clarity to that," he said on a visit to Geneva.
The EU had insisted it would only move on to trade talks if there was enough progress on three key issues: the money Britain must pay to the EU; rights for EU citizens in Britain and British citizens in the EU; and how to avoid a hard border with Ireland.
"I believe we have now made the breakthrough we needed," Juncker said.
On citizens rights, London and Brussels agreed to offer equal treatment on social security, healthcare, employment and education and that Britain will enable its judges to ask the European Court of Justice to weigh in when necessary for eight years after Brexit, aiming to create a common body of law.
But the crucial breakthrough was on the future of the 310-mile (500-km) UK-EU land border on the island of Ireland. The Northern Irish DUP had vetoed a draft deal on Monday.
May stayed up most of the night into Friday, grabbing just a couple of hours sleep, as she worked the phones from Downing Street to secure agreement from Dublin, Brussels and the DUP.
They agreed to avoid a hard border which might upset the peace established after decades of Protestant-Catholic violence, but said the details would be agreed as part of talks about the future relationship, according to a 15-page negotiators report.
Britain agreed that should London and Brussels fail to agree a final Brexit deal, the United Kingdom will maintain "full alignment" with those rules of the internal market and customs union that help protect north-south cooperation in Ireland.
"In all circumstances, the United Kingdom will continue to ensure the same unfettered access for Northern Ireland's businesses to the whole of the United Kingdom internal market," it said.
The DUP gave only a conditional endorsement of the new terms: "We cautioned the prime minister about proceeding with this agreement in its present form given the issues which still need to be resolved," its leader Arlene Foster said.
"Nothing is agreed until everything is agreed and how we vote on the final deal will depend on its contents."
It remains unclear how Britain can fully meet all three key pledges it has made on the border: keeping Northern Irish rules in line with the EU, keeping Northern Ireland aligned with the UK mainland and allowing the UK to diverge from EU regulations.
"It's still a fudge," said one senior EU official. "They put off squaring the circle till later. But how can they do it?"
For Brussels and Dublin, however, the key commitment was the first. "The rest is Theresa May's problem," the official said.