The plan isn’t perfect. It is expensive, messy and loaded with moral and political compromises. If finalized and implemented, it would still leave hundreds of thousands of refugees stranded in countries where they have no desire to settle. Inevitably, it would also require local officials to use coercion, and the police to use force, in moving migrant families against their will. But it is still the closest that European leaders have come to finding a way out of the refugee crisis. Here’s what you need to know about the agreement proposed on Monday in Brussels.

Turkey can make or break this deal. As the main transit country for migrants heading to Europe, Turkey would have to get serious about stopping the boats they use to reach the Greek islands. That would require a massive police operation all along Turkey’s western coast, where migrant smugglers have tended to work with impunity. It would also mean a crackdown on the corrupt officials who have allowed the smugglers to operate. Turkey has the resources to manage this effort, but it has so far been short on political will.

Europe will pay through the nose. As a kind of down payment on the deal to curb the flow of refugees, the Turkish government demanded 6 billion euros from the European Union at the start of the talks on Sunday. The money is meant to help pay for accommodations that would make life more bearable for more than 2.5 million Syrian refugees currently living in Turkey, thereby discouraging them from making the onward journey to Europe. But the E.U. would likely have little control over how this money is spent.

Some migrants will have to go back. In one of the major breakthroughs of Monday’s agreement, Turkey said it would be ready to take back migrants who depart from its shores and reach Europe. It’s not clear how European authorities will enforce this provision. But it seems likely to make for some ugly scenes of deportation. Having risked their lives during the boat journey from Turkey, asylum seekers will not be likely to go back voluntarily. In many cases, if not all of them, the police will have to force them out.

The lucky few will get a legal path to asylum. As part of the agreement, the E.U. would have to establish a mechanism for refugees to travel directly from Turkey to whatever E.U. country will grant them asylum. This would allow many migrants to avoid the dangerous journey by boat to Greece. The vetting process would, however, be stringent, especially considering the widespread fears that Islamic extremists could sneak into the E.U. by masquerading as refugees. It is also unclear how the E.U. would distribute the refugees it accepts directly from Turkey. Hungary has already pledged to veto any E.U. effort to force all of its member states to accommodate their share. That would leave Germany and other wealthy European nations to continue carrying a disproportionate share of the burden.

The razor wire fence built by Macedonian authorities that separates Greece, right, and Macedonia, is seen near the Greek village of Idomeni, March 5, 2016. Eldar Emric—AP

Turkey’s demands will be hard to meet. In exchange for helping to stem the flow of migrants, the Turkish government has also asked for E.U. membership and visa-free travel for its citizens to most E.U. countries. European leaders agreed, at least in principle, to accelerate talks on both these issues. But granting membership to Turkey would require the E.U. to compromise on some of its core values of human rights and press freedom, which the Turkish government has repeatedly violated. Most recently, it shut down the country’s most popular opposition newspaper just a few days before Monday’s summit began. To avoid jeopardizing the agreement on refugees, European leaders may need to hold their tongues over the Turkish assault on media freedom.

NATO is getting involved. The world’s most powerful military alliance does not normally do police work. But its warships will soon be deployed to patrol the waters between Greece and Turkey, looking for any migrant boats and smugglers trying to come across. It will not be NATO’s job to turn these boats around, but if it finds any migrants “in distress” in these waters, NATO’s forces will be able to pluck them from the water and take them back to Turkey. In practice, that could provide the alliance’s ships with broad powers to police these waters, because migrants risking their lives in overcrowded rubber dinghies are, in some sense, always in distress. NATO’s primary mission, however, will be to coordinate the efforts of Greek and Turkish coast guards, whose mutual mistrust has hampered anti-smuggling efforts along their maritime border for years.

Greece is getting the worst part of the deal. Tens of thousands of migrants were stranded in Greece last month after Macedonia, its neighbor to the north, shut the border to most asylum seekers. The E.U. has promised to provide financial aid to help Greece accommodate these migrants. But the burden will still be hard to manage for one of the poorest countries in the E.U. As the Greek Prime Minister Alexis Tsipras artfully put it last month, his country now risks becoming a “warehouse of souls.”

Germany can finally point to some way out of the crisis. After taking in more than a million migrants last year, Germany faced a full-blown political crisis over the accommodation and integration of all the new arrivals. Chancellor Angela Merkel’s approval ratings have plummeted because of the influx, and with regional elections coming up this weekend, her political party was desperate for a deal. So for all its flaws and ambiguities, the Brussels agreement has at least shown the way toward a solution. Next week Turkish and European leaders will meet again to discuss the details and try to finalize the plan. After that would come the hard part: implementation.

Get The Brief. Sign up to receive the top stories you need to know right now. Please enter a valid email address. Sign Up Now Check the box if you do not wish to receive promotional offers via email from TIME. You can unsubscribe at any time. By signing up you are agreeing to our Terms of Use and Privacy Policy . This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply. Thank you! For your security, we've sent a confirmation email to the address you entered. Click the link to confirm your subscription and begin receiving our newsletters. If you don't get the confirmation within 10 minutes, please check your spam folder.

Contact us at letters@time.com.