The refugee crisis was already leading to the slow disintegration of the European Union. Then, on June 23, it contributed to an even greater calamity — Brexit. Both of these crises have reinforced xenophobic, nationalist movements across the continent. They will try to win a series of key votes in the coming year — including national elections in France, the Netherlands, and Germany in 2017, a referendum in Hungary on EU refugee policy on Oct. 2, a rerun of the Austrian presidential election on the same day, and a constitutional referendum in Italy in October or November of this year.

Rather than uniting to resist this threat, EU member states have become increasingly unwilling to cooperate with one another. They pursue self-serving, discordant migration policies, often to the detriment of their neighbors. In these circumstances, a comprehensive and coherent European asylum policy is not possible in the short term, despite the efforts of the EU’s governing body, the European Commission. The trust needed for cooperation is lacking. It will have to be rebuilt through a long and laborious process.

This is unfortunate, because a comprehensive policy ought to remain the highest priority for European leaders; the union cannot survive without it. The refugee crisis is not a one-off event; it augurs a period of higher migration pressures for the foreseeable future, due to a variety of causes including demographic and economic imbalances between Europe and Africa, unending conflicts in the broader region, and climate change. Beggar-thy-neighbor migration policies, such as building border fences, will not only further fragment the union; they also seriously damage European economies and subvert global human rights standards.

What would a comprehensive approach look like? It would establish a guaranteed target of at least 300,000 refugees each year who would be securely resettled directly to Europe from the Middle East — a total that hopefully would be matched by countries elsewhere in the world. That target should be large enough to persuade genuine asylum-seekers not to risk their lives by crossing the Mediterranean Sea, especially if reaching Europe by irregular means would disqualify them from being considered genuine asylum-seekers.

This could serve as the basis for Europe to provide sufficient funds for major refugee-hosting countries outside Europe and establish processing centers in those countries; create a potent EU border and coast guard; set common standards for processing and integrating asylum-seekers (and for returning those who do not qualify); and renegotiate the Dublin III Regulation in order to more fairly share the asylum burden across the EU.

The current piecemeal response to the crisis, culminating in the agreement between the EU and Turkey to stem refugee flows from the Eastern Mediterranean, suffers from four fundamental flaws. First, it is not truly European; the agreement with Turkey was negotiated and imposed on Europe by German Chancellor Angela Merkel. Second, the overall response is severely underfunded. Third, it has transformed Greece into a de facto holding pen with inadequate facilities. Finally, it is not voluntary: It is trying to impose quotas that many member states strenuously oppose and requires refugees to take up residence in countries where they are not welcome and where they do not want to go while returning to Turkey others who reached Europe by irregular means.

The agreement with Turkey was problematic even before the July 15 coup attempt that has plunged Europe’s future into even greater uncertainty. On one level, the agreement seems to be a success, since the Balkan route is largely blocked and refugee flows to Greece have fallen to a trickle. But refugee flows have surged on the more dangerous Mediterranean routes. At the same time, the very premise of the deal — that asylum-seekers can legally be returned to Turkey — is fundamentally flawed. Greek courts and asylum committees have consistently ruled that Turkey is not a “safe third country” for most Syrian asylum-seekers, a perspective likely to be reinforced after the coup attempt. The recent reorganization of the asylum appeals committees in Greece to make them more government-friendly is liable to be challenged in the courts, as will the European Commission’s July 13 proposal to override the decisions of national courts.

Meanwhile, the EU-Turkey deal, built on the premise that refugee rights can be traded for financial and political favors, is now being used as a template more broadly. Last month, the European Commission called for making development funds contingent on the implementation of migration controls by African partners. This violates the values and principles that ought to guide the European Union, constitutes a break with decades of practice in development funding, and degrades the treatment of both migrants and refugees. The grand bargain with countries in Africa and elsewhere cannot simply be: If you stop migrants from coming to Europe, you can do anything else you want. This approach damages everyone, morally, politically, and economically. A true grand bargain would focus on development in Africa — real development that over a generation would actually address the root causes of migration that so many politicians frequently invoke in their rhetoric and just as frequently disregard in practice.

An effective alternative to the EU’s current approach would be built on seven pillars.

First, the EU and the rest of the world must take in a substantial number of refugees directly from front-line countries in a secure and orderly manner, which would be far more acceptable to the public than the current disorder. If the EU made a commitment to admit even just 300,000 refugees each year, and if that commitment were matched by countries elsewhere in the world, most genuine asylum-seekers would calculate that their odds of reaching their destination are good enough for them not to seek to reach Europe illegally, since that would disqualify them from being legally admitted. If, on top of this, conditions in front-line countries improved thanks to greater aid, there would be no refugee crisis. But the problem of economic migrants would remain.

This brings us to the second point: The EU must regain control of its borders. There is little that alienates and scares publics more than scenes of chaos. Fifteen months after the acute phase of the crisis began, confusion continues to reign in Greece and its Mediterranean waters. More than 50,000 refugees live in squalor in a series of poorly organized, impromptu camps throughout the country. Europeans see this on their screens and wonder why the mighty European Union is incapable of supplying even basic provisions to children and women fleeing war. Meanwhile, the most advanced navies of the world appear incapable of saving those crossing the Mediterranean; the number of drownings has increased dramatically this year. The cynical explanation for all this — that the EU is intentionally allowing these conditions to persist so that they serve as a deterrent — is equally troubling.

The immediate remedy is simple: provide Greece and Italy with sufficient funds to care for asylum-seekers, order navies to make search-and-rescue missions (and not “protection” of borders) their priority, and implement the promise to relocate 60,000 asylum-seekers from Greece and Italy to other EU member states.

Third, the EU needs to develop financial tools that can provide sufficient funds for the long-term challenges it faces and not limp from episode to episode. Over the years, the EU has had to finance an ever-growing number of undertakings with a shrinking pool of resources. In 2014, member states and the European Parliament agreed to reduce and cap the overall EU budget at a modest 1.23 percent of the sum of its members’ GDPs until 2020. That was a tragic mistake. The EU cannot survive with a budget of this size.

At least 30 billion euros a year will be needed for the EU to carry out a comprehensive asylum plan. These funds are needed both inside the union — to build effective border and asylum agencies and ensure dignified reception conditions, fair asylum procedures, and opportunities for integration — as well as outside its borders — to support refugee-hosting countries and spur job creation throughout Africa and the Middle East. Robust border and asylum agencies alone could cost on the order of 15 billion euros.

Although 30 billion euros might seem like an enormous amount, it pales in comparison to the political, human, and economic costs of a protracted crisis. There is a real threat, for instance, that Europe’s Schengen system of open internal borders will collapse. The Bertelsmann Foundation has estimated that abandoning Schengen would cost the EU between 47 billion and 140 billion euros in GDP lost each year.

The current approach is based on reallocating minimal amounts from the EU budget and then asking member states to contribute to various dedicated vehicles, such as the Facility for Refugees in Turkey and the EU Regional Trust Fund for Syria, which were used, respectively, to provide financial compensation for Turkey and additional EU funding to international organizations and neighboring countries as a response to the Syrian crisis. These, however, can only be a temporary solution, as they are neither sustainable nor large enough to finance efforts that must grow in size and scope. Although these trust funds can be powerful instruments in the short term to redeploy resources and allow member states to commit more funds to a particular endeavor, they also illustrate the fundamental deficiency of the current system — namely that it remains dependent on the good will of the member states at each step.

In order to raise the necessary funds in the short term, the EU will need to engage in what I call “surge funding.” This entails raising a substantial amount of debt backed by the EU’s relatively small budget, rather than scraping together insufficient funds year after year. Today, the EU stands out for having a remarkably low amount of debt given the size of its budget; it should therefore leverage this budget like all sovereign governments in the world do.

Spending a large amount at the outset in that way will allow the EU to respond more effectively to some of the most dangerous consequences of the refugee crisis and prevent some of its worst consequences. These include anti-immigrant sentiment in its member states that has fueled support for authoritarian political parties and despondency among those seeking refuge in Europe, who now find themselves marginalized in Middle East host countries or stuck in transit in Greece. Making large initial investments in border protection, search-and-rescue operations, asylum processing, and dignified refugee sheltering will help tip the economic, political, and social dynamics away from xenophobia and disaffection and toward constructive outcomes that benefit refugees and host countries alike. In the long run, this will reduce the total amount of money Europe will have to spend to contain and recover from the refugee crisis.

To finance it, new European taxes will have to be levied sooner or later. In the meantime, needs can be partially met by mobilizing the unused credit of already existing EU financial instruments: balance-of-payments assistance, Macro-Financial Assistance, and the European Financial Stabilization Mechanism (EFSM). These instruments together have more than 50 billion euros of unused credit available. The facilities would have to be repurposed and their mandate expanded, which would meet considerable resistance. But those are not good enough reasons to avoid tapping the unused financial capacity of the European Union.

At the height of the euro crisis, member states were able to summon the political will to rapidly create a new set of instruments that vastly augmented the financial power of the EU. The EFSM, which then became the European Stability Mechanism, raised the borrowing capacity of the EU to some 500 billion euros in just a year, proving that when there is a will, there is a way. But all these instruments face three limitations: They are mostly intergovernmental and rely on member-state guarantees rather than the EU budget, which remains too small to undertake such large borrowing; they require unanimous authorization by the member states; and they are essentially designed to lend money to other member states rather than engage true spending in the name of the EU.

The only way ahead is to form “coalitions of the willing” that do not require unanimous consent. These initiatives could inspire deeper reforms of the EU budget. I was therefore greatly encouraged last year when German Finance Minister Wolfgang Schäuble suggested a pan-European gasoline tax. I was soon disillusioned, however, when he explicitly warned against utilizing the largely unused borrowing power of the European Union.

The very existence of the European Union is at stake. It is the height of irresponsibility and a dereliction of duty to allow the EU to disintegrate without utilizing all its financial resources. Throughout history, governments have issued bonds in response to national emergencies. When should the EU use its largely untapped borrowing capacity if not at a moment when it is in mortal danger? Doing so would have the additional advantage of providing a much needed economic stimulus. With interest rates at historic lows, now is a particularly favorable moment to take on such debt.

Fourth, the crisis must be used to build common European mechanisms for protecting borders, determining asylum claims, and relocating refugees. Some modest progress is underway: Legislation establishing a European Border and Coast Guard was adopted this month by the European Parliament. But the Dublin III Regulation — the basis of determining which country bears responsibility for processing and hosting asylum-seekers — prevents solidarity among EU member states by putting most of the burden on the country of first entrance; it needs to be renegotiated.

A European solution is currently emerging on the ground in Greece, where the European Asylum Support Office (EASO) de facto examines asylum applications in order to assist the overwhelmed Greek authorities. A single European asylum procedure would remove the incentives for asylum shopping and rebuild trust among member states.

Fifth, once refugees have been recognized, there needs to be a mechanism for relocating them within Europe in an agreed way. It will be crucial for the EU to fundamentally rethink the implementation of its stillborn resettlement and relocation programs; a tentative step in this direction was taken last week in new proposals put forth by the European Commission. The union cannot coerce either member states or refugees to participate in these programs. They must be voluntary; a matching scheme could elicit preferences from both refugees and receiving communities so that people end up where they want to be and where they are welcome. EASO has begun to develop such a matching scheme.

These programs should be deeply anchored in communities. Mayors across Europe have shown a remarkable willingness to receive refugees but have been thwarted by national governments. Public-private sponsorship programs — wherein small groups of individuals, community organizations, and companies support newcomers, financially and otherwise, as they negotiate schools, job markets, and communities — could benefit from the untapped goodwill of citizens throughout Europe.

Canada provides a good role model (although its geographic context differs from Europe’s). In just four months, it admitted 25,000 Syrian refugees and is integrating them through public-private partnerships and local nonprofits. The government has promised to accept another 10,000 Syrians by year’s end and 44,000 refugees in total in 2016. (At the same time, it is admitting 300,000 migrants in total every year; this would be the equivalent of the EU accepting 4.5 million migrants annually.)

The process by which Canada resettles refugees has been refined through repeated use over a long period of time and passes even the hyperstringent security standards of its southern neighbor. The vetting of Syrian asylum-seekers was meticulously carried out by some 500 consular and military officials mobilized immediately after Prime Minister Justin Trudeau took office last November and made the project a top priority. Both the public and media responded positively, despite the shock of the terrorist attacks in Paris and Brussels, which occurred at the height of Canada’s Syrian refugee program. Determined leadership from the top, close coordination with receiving local communities, robust screening and resettlement procedures, and honesty in confronting inevitable problems — these were the main ingredients of success. Compare that to conditions prevailing in Europe, and you get an indication of the distance that the EU has to travel.

Sixth, the European Union, together with the international community, must support foreign refugee-hosting countries far more generously than it currently does. The required support is in part financial, so that countries such as Jordan can provide adequate schooling, housing, training, and health care to refugees, and partly in the form of trade preferences, so that these countries can provide employment both to refugees and to their own populations. It simply does not make sense for Europe to commit upwards of 200 billion euros between 2015 and 2020 to deal with the crisis on its own shores — this is the amount member states are on track to spend on refugee reception and integration — when a small fraction of that amount spent abroad would have kept the influx of migrants to manageable proportions.

Equally, the EU must be more generous in its approach to Africa and not merely offer financial aid in exchange for migration controls, as the European Commission proposed last month. This approach simply empowers African leaders to wield migration as a threat against Europe, much as Erdogan has done. Instead, it must focus on real development in Africa. This means free trade, massive investment, and a commitment to rooting out corruption.

Some leaders in Europe have called for a Marshall Plan for Africa. This is an admirable ambition. But when it comes to the details, Europe is far away from such a vision. After World War II, the United States invested 1.4 percent of its GDP to help rebuild Europe — every year for four years. An investment on the scale of the original Marshall Plan would require around 270 billion euros a year for the next four years, a number we are very far from.

The seventh and final pillar is that, given its aging population, Europe must eventually create an environment in which economic migration is welcome. Merkel opened Germany’s doors wide to refugees, but her generous act was not well thought through; it ignored the pull factor. A sudden influx of more than a million asylum-seekers overwhelmed the capacity of the authorities, turning public opinion against migrants. Now the EU urgently needs to limit the overall inflow of newcomers, and it can do so only by discriminating against economic migrants. Hopefully, this is temporary, but while it lasts, it is both inappropriate and damaging.

The benefits brought by migration far outweigh the costs of integrating immigrants. Skilled economic immigrants improve productivity, generate growth, and raise the absorptive capacity of the recipient country. Different populations bring different skills, but the contributions come as much from the innovations they introduce as from their specific skills — in both their countries of origin and their countries of destination. There is plenty of anecdotal evidence for this, starting with the Huguenots’ contribution to the first industrial revolution by bringing both weaving and banking to England. All the evidence supports the conclusion that migrants have a high potential to contribute to innovation and development if they are given a chance to do so.

Pursuing these seven principles is essential in order to calm public fears, reduce chaotic flows of asylum-seekers, ensure that newcomers are fully integrated, establish mutually beneficial relations with countries in the Middle East and Africa, and meet Europe’s international humanitarian obligations.

The refugee crisis is not the only crisis Europe has to face, but it is the most pressing. And if significant progress could be made on the refugee issue, it would make the other issues — from the continuing Greek debt crisis to the fallout from Brexit to the challenge posed by Russia — easier to tackle. All the pieces need to fit together, and the chances of success remain slim. But as long as there is a strategy that might succeed, all the people who want the European Union to survive should rally behind it.