A late Thursday-night meeting among European Union leaders in Brussels ended with a significant agreement, requiring EU leaders to relocate 40,000 asylum seekers, who are currently being sheltered in Italy and Greece, across the rest of the 28-member bloc. The summit, however, did not reach an accord that would mandate the number of migrants each country lets in.

The migrants, who have fled war and poverty in North Africa and the Middle East to find safe haven in Europe, will be relocated to other EU states over the next two years, BBC reported, citing Donald Tusk, chairman of the EU summit and president of the European Council. The only countries that have been granted an exemption are Hungary, which has received thousands of refugees from across the Serbian border and earlier criticized the relocation plan as absurd, and Bulgaria, one of the EU’s poorest nations.

“There was generally a very engaged discussion, which I believe is appropriate for this issue, because with the migration question we are facing the biggest challenge for the European Union that I have seen during my time in office,” the Wall Street Journal quoted German Chancellor Angela Merkel as saying, after the discussions.

EU leaders sparred for about seven hours on how to confront the migrant crisis, and eventually agreed that member states would have until the end of July to finalize the plan to help provide homes across the EU to asylum seekers. The leaders also reportedly agreed to resettle another 20,000 people currently outside the EU.

The U.K. has opted out of the plan while some Eastern European nations have refused to accept set quotas, which reportedly angered Italian Prime Minister Matteo Renzi, who described the plan as “modest,” BBC reported.

European Commission President Jean-Claude Juncker also called the effort a “modest ambition” and downplayed objections to the plan's fundamental methodology.

“We have to find out if the system works. It doesn't matter if it is voluntary or mandatory, it is whether it can help 60,000 refugees,” Reuters quoted Juncker as saying.

According to a recent report by Amnesty International, excessive “cruelty” and abuse faced by migrants in Libya have forced many to undertake the dangerous Mediterranean crossings to reach Europe. People fleeing conflicts in other parts of Africa and the Middle East, have also added to the swelling numbers of refugees landing on southern European shores. 

According to latest figures from the United Nations High Commissioner for Refugees, 63,000 migrants have arrived in Greece by sea this year while 62,000 have landed in Italy.

“I have no doubt that it will take much time to build new European consensus on migration. But first and foremost, we need to contain illegal migration and this should be our priority,” the Journal quoted Tusk as saying.