VALLETTA, Malta — The European Union appeared a step closer on Thursday to a deal with Turkey that would represent its most ambitious attempt yet in trying to regulate the flow of migrants to the Continent.

At the end of a two-day summit meeting in Malta, officials with the European Union said they had agreed to offer Turkey 3 billion euros, or about $3.2 billion, over the next two years to help Turkey cope with the more than two million Syrian refugees who had sought refuge there.

The leaders also agreed to invite President Recep Tayyip Erdogan of Turkey to a summit meeting in Brussels with the bloc’s 28 leaders to discuss a range of issues that could include the country’s long-stalled bid to join the union as well as efforts to help curb migration.

Many of the migrants making their way from Syria, Iraq, Afghanistan and other nations to Western Europe travel through Turkey. Reaching an accord with Mr. Erdogan and the Turkish government is widely seen as vital to reducing the flow of people through the Balkans and eventually to Germany, Sweden and other rich countries in Northern Europe.