EU leaders have endorsed a stiff set of divorce terms for Britain at a summit in Brussels, rejoicing in a rare show of unity in adversity.

Leaders met on Saturday for the first time since British Prime Minister Theresa May formally triggered a two-year countdown to Brexit in late March as they approved eight pages of negotiating guidelines hammered out by their diplomats over the past month.

"Guidelines adopted unanimously. EU27 firm and fair political mandate for the Brexit talks is ready," summit chair Donald Tusk tweeted.

The guidelines will bind Michel Barnier, their chief negotiator, to seek a deal that secures the rights of three million EU expats living in Britain, ensure London pays tens of billions of euros Brussels thinks it will be owed, and avoids destabilising peace by creating a hard EU-UK border across the island of Ireland.

"The message is that nobody here is trying to be antagonistic towards Theresa May's government in Britain," Al Jazeera's Nadim Baba, reporting from Brussels, said.

"What is needed is unity to get a deal done within the two-year timeframe. May has been saying that people are lining up against Britain."

Free trade talks

The EU rules out discussing the free trade deal May wants until sufficient progress is made on agreeing to key withdrawal terms.

"Before discussing the future, we have to sort out our past," Tusk said in comments echoed by German Chancellor Angela Merkel, who said "substantive issues" must first be settled.

That decision on what is "sufficient" to warrant trade talks is the kind of debate that can poison relations as the 27 nations seek to protect national interests. Also contentious will be which countries scoop up the prizes of hosting two EU agencies set to be moved from London.

READ MORE: EU says Brexit plans unchanged by UK snap election call

With most of the 27 offering to house the European Medicines Agency and several wanting the European Banking Authority, Tusk and EU chief executive Jean-Claude Juncker will propose criteria for making the choices to avoid unseemly rows.

In a mark of how last year's Brexit vote has called into question the unity of the UK itself, leaders will also offer Irish Prime Minister Enda Kenny a pledge that if Northern Ireland, which voted against Brexit, ever unites with his country, it will automatically be in the EU.

Among possible differences, the priorities of poor, eastern states are to secure residency rights for their many workers in Britain and British money for the EU budget.