European Union leaders have reached an agreement on migration after nearly 10 hours of talks at a summit in Brussels.

Italy - the entry point of thousands of migrants, mainly from Africa - had threatened to veto the conclusions of the group's entire agenda if it did not receive help on the issue.

Talks continued into the early hours of Friday before a compromise was reached.

Leaders said that new migrant centres could be set up in EU countries on a "voluntary" basis.

These centres would process migrants to determine which are genuine refugees and which are "irregular migrants, who will be returned", the text of their agreement says.

European Council President Donald Tusk confirmed that a joint communique had been reached in a tweet on Friday morning.

Following the marathon talks, France's President Emmanuel Macron said that "European co-operation enabled this".

The 28 EU leaders also agreed to strengthen external border controls, and boost financing for Turkey, Morocco and countries in North Africa.

The agreement states that there is an urgent need to boost efforts to "prevent the development of new sea or land routes" into Europe.

Italian Prime Minister Giuseppe Conte had earlier taken the rare step of blocking the conclusions of the joint communique until the leaders had settled the migration issue. Both Italy and Greece want other countries to share the burden.

German Chancellor Angela Merkel said earlier that the issue could be a defining moment for the EU.

Mrs Merkel came into the summit under pressure to come up with a deal to prevent new arrivals in Germany by migrants who have already registered elsewhere.

Interior Minister Horst Seehofer, from her Bavarian coalition partner the CSU, had given her a deadline of this weekend. He has threatened to start turning away migrants from the border in his home state.

Without the CSU, Mrs Merkel would lose her parliamentary majority.

The migrant flows also include refugees fleeing the Syrian war and other conflicts, urgently seeking asylum.

It is not a crisis on the scale of 2015, when thousands were coming ashore daily on the Greek islands. The European Council - the EU's strategic leadership - says the numbers illegally entering the EU have dropped 96% since their peak in October 2015.

But this month's tensions over migrant rescue ships barred from entry to Italian ports - most recently the German charity ship Lifeline - have put the issue firmly back in the EU spotlight.

The Lifeline was only allowed to dock in Malta after intense diplomacy among several EU states, who each agreed to take a share of the migrants on board. Malta said that Norway had now also agreed to take some migrants from the Lifeline.