The European Union and Turkey have agreed on a mutual action plan to stem the flood of refugees and migrants from the latter into the former, Reuters reported on Friday.

Speaking at a summit in Brussels, E.U. leaders said they would offer Turkey a sizable aid package, and greater access to visas for Turkish citizens, if the country agreed to better control its borders, through which hundreds of thousands of displaced persons from the Middle East have entered Europe this year. From Turkey, they make the sea crossing to Greece and travel to points north.

Turkish officials requested €3 billion ($3.4 billion) in aid, Reuters reported, a sum that German Chancellor Angela Merkel called practical. In exchange, Ankara will also work to better the conditions of the 2 million refugees currently in Turkey, perhaps encouraging them to remain in the country.

Read More: These Photos Show the Massive Scale of Europe’s Migrant Crisis

European leaders also tentatively agreed to re-evaluate Turkey’s long-standing application to join the E.U.

“There is still a huge amount to do,” Merkel said, according to the BBC. “But you cannot say that we’ve achieved nothing.”

The Brussels meeting was the fourth E.U. summit this year held to address the ongoing migrant crisis, which has brought 600,000 people to Europe in 2015 alone. European Council president Donald Tusk, who chaired the summit, expressed a “cautious optimism” over the deal.

The severity of the situation was underscored early Friday, when an Afghan migrant attempting to enter Bulgaria from Turkey was fatally shot down by border guards.

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.