The U.K. and the European Union have struck a deal to unlock divorce negotiations, opening the way for talks on what businesses are keenest to nail down – the nature of the post-Brexit future.

A deal was sealed before dawn Friday in Brussels after talks went through the night. While the EU said it had given ground, Prime Minister Theresa May conceded on all the main issues, bringing to Brussels an offer on the financial settlement, an agreement on Europeans living in the U.K. and a solution to keep open the border that divides the island of Ireland after the split.

The last turned out to be the thorniest, requiring delicate four-way talks as the Northern Irish party that holds the balance of power in London wielded a powerful veto until the last minute. The issue is far from resolved and threatens to dog the next stage of negotiations. The leader of the Northern Irish party that holds the balance of power in London said her lawmakers could still vote down a final exit deal if they’re not happy.

The U.K. has now won the prize it has been seeking since March – the right to start discussing relations between the two when Britain parts ways with the bloc after 40 years. Crucially, the EU said it was ready to start talking about the transition deal that businesses are keen to pin down. But EU officials warned that the most difficult bit lies ahead.

“So much time has been devoted to the easier part of the task and now to negotiate a transition arrangement and the framework for our future relationship we have, de facto, less than a year,” European Council President Donald Tusk said. “We all know that breaking up is hard but breaking up and building a new relation is much harder.”

A trade deal may take years to formulate, and allowing companies and even people to adapt to the new reality will take time. That’s why the two-year transition that May seeks is key – businesses want to know how long they have to plan for the future, whether that means relocation or continued investments.

May’s Conservative administration is fiercely divided over Brexit – her Cabinet has yet to decide what kind of trading arrangements it wants from Europe. Tusk called for clarity on that on Friday.

The second phase will be even more delicate and important than the first. The two sides are going in with widely different expectations; the EU unity that was on display in the first phase could now splinter as interests diverge; and trade deals don’t usually cover the service industries that make up most of the U.K. economy.

Britons will also be watching to see if talks live up to what was promised: they were told that Brexit would mean free trade deals with Europe and the rest of the world, controls on European immigration and the repatriation of regulation.

May has said she wants a deep and special partnership and a better deal than the free-trade agreement that Canada secured from the EU. But ministers will have to decide what they are willing to sacrifice in order to get what they want and the answer will vary from one faction to another within government and within the Tory Party.

The EU has already started mapping out what it intends to put on the table – a deal along the lines of the one it offered Canada. That deal was the best in its class but still far short of what the U.K. currently enjoys as a full member of the single market and customs union.

May has got the deal that she needed – and the agreement that businesses were clamoring for. Amid off-and-on threats to oust her, failure to move talks along could have cost May her job, and brought more instability.

Pro-Brexit Conservatives including Foreign Secretary Boris Johnson were initially supportive of the deal. But lawmakers have objected to the role given to the European Court of Justice in the U.K. after Brexit. Johnson voiced concerns to May earlier this week when it looked like she was aiming for to preserve EU rules after the divorce and he made clear in a tweet what he expects to come next.

Also, no one should expect the Irish problem – whose roots go back centuries – to go away. The wording of the Irish text leaves room for the border issue to continue rearing its head in the second phase of talks. The Republic of Ireland wants no border on the island, the U.K. wants to leave the single market that makes the almost invisible border possible, and the Democratic Unionist Party that props up May in London is adamant that any efforts to prevent a border on the island don’t create the need for a boundary between Northern Ireland and mainland Britain.

Bloomberg’s Tim Ross, Dara Doyle, Marine Strauss, Jones Hayden and Alex Morales contributed to this story.