The 27 leaders of the European Union (EU) have reached an agreement on how to deal with the latest wave of refugees flooding across the Mediterranean, fleeing violence and conflict across the Sahel — and how to deal with the serious impediments posed by Italy and Malta in refusing to take in vessels carrying humanitarian cargoes.

The deal reached in overnight talks early on Friday morning must also be enough to overcome the political opposition to refugees posed by the regional government in Bavaria that threatens German Chancellor Angela Merkel’s federal coalition, and right-wing administrations in Hungary and Poland that are fundamentally opposed to accepting any refugee quotas. For now, the EU27 deal seems to have enough to paper over those divisions.

The EU27 has agreed to establish “control centres” at locations still to be decided, where rescued refugees will be sent for processing — and only in countries that agree to house them. The measure offers the new right-wing government in Italy an opportunity to claim a victory in that it will no longer bear the brunt of tens of thousands of refugees who end up on its shores after their dangerous crossing of the Mediterranean.

The EU27 has backed plans to tighten the EU’s external borders and give more money to countries such as Turkey and Morocco that house refugees, to prevent them from reaching the bloc and agreed to set up processing centres in other countries such as Algeria, Egypt, Morocco, Niger and Tunisia to stem the over-flow of refugees seeking asylum in Europe.

The deal may not be the best for refugees, but it is a political solution for now — and that’s good enough for EU27.