European leaders have reached a deal on migration after tense and lengthy talks, but the pledges made to strengthen borders were vague and a bleary-eyed German Chancellor Angela Merkel conceded differences remained.
Under the agreement, reached after nine hours of often stormy talks, EU leaders agreed to share out refugees arriving in the bloc on a voluntary basis and create "controlled centres" inside the European Union to process asylum requests.
They also agreed to share responsibility for migrants rescued at sea, a key demand of Italy's new Prime Minister Giuseppe Conte.
"Italy is not alone anymore," he said.
Conte, whose government includes the anti-establishment 5-Star movement and far-right League, had earlier refused to endorse a summit text on security and trade until other leaders had pledged to help Italy manage Mediterranean arrivals.
The Brussels meeting underscored how Europe's 2015 spike in immigration continues to haunt the bloc, despite a sharp drop in arrivals of people fleeing conflict and economic hardship in the Middle East and Africa.
It took place in an atmosphere of political crisis, with German Chancellor Angela Merkel under intense political pressure at home to take a firmer stance on migration.
Merkel, speaking to reporters at 5am, sought to put a positive spin on the result, saying it was a good signal that leaders had been able to agree a common text on the migration issue.
But she acknowledged that the bloc still had "a lot of work to do to bridge the different views."
French President Emmanuel Macron, who has sharply criticised Italy for refusing to allow a migrant rescue ship into its ports, said European cooperation had "won the day".
In a final statement full of convoluted language designed to satisfy the divergent views, the leaders agreed to restrict migrant moves within the bloc but made clear virtually all of their pledges would be carried out on a "voluntary basis" by member states.
They also agreed to tighten their external border and increase financing for Turkey, Morocco and other North African states to prevent migration to Europe.
It was unclear whether the deal would be enough to appease Merkel's coalition partner, the Christian Social Union (CSU), which has threatened to shut Bavaria's border to migrants. That could trigger the collapse of her three-month-old government as well as the EU's Schengen zone of free travel.
Diplomats described a tense, tortured meeting with small groups of leaders huddled together in a desperate bid to break the deadlock and avert the humiliation of heading home without having produced an agreement.
Early in the evening, Merkel and Conte set aside 45 minutes for a chat, only to break it off after 20 minutes when the Italian leader rejected the German leader's overtures, according to diplomats.
Before the dinner clash over migration started, Conte, head of a new government that includes the anti-establishment 5-Star movement and far-right League, refused to endorse a summit text on security and trade until other leaders had bowed to his demands to help Italy manage the Mediterranean arrivals.
That forced the summit chairman Donald Tusk and European Commission President Jean-Claude Juncker to cancel their pre-planned news conference.
"It is so toxic. They go into the room, clash, storm out, go back again, clash again. With no end in sight," said one exasperated diplomat as dawn approached.
"It's pure politics driving this, emotions are flying as high as back in 2015," another EU diplomat said.
Fewer than 45,000 migrants have made it to the European Union this year, according to UN data, a sharp drop from the wave of 2015 when many thousands were entering on a daily basis.