Fractious European leaders argued into the early hours on Friday over how to handle a migrant crisis in the Mediterranean, agreeing a plan to share out the care of desperate people fleeing war and poverty in North Africa and the Middle East.

Determined not to be dragged into negotiations over Greece's debt debacle at their summit in Brussels, leaders instead found themselves sparring for seven hours about whether to take in 40,000 Syrian and Eritrean asylum seekers now in Italy and Greece and another 20,000 people currently outside the EU.

They eventually agreed a voluntary scheme, sticking to the 60,000 number but granted an exclusion for Hungary, which earlier described the plan as absurd, as well as for Bulgaria, one of the EU's poorest countries.