The people running the EU have always wanted it to be uniform. True, Britain and Denmark were granted opt-outs from the euro, judicial co-operation and some other areas, but the orthodoxy in Brussels, Berlin and Paris has been that all member states should be committed to the same aims and ambitions, even if some are progressing towards them more quickly than others. EU officials still claim that Poland is only a few years away from joining the euro, even though that is not how it seems in Warsaw.

But as the EU navigates the challenges of Brexit, migrant flows, a still-problematic eurozone and a hostile neighbourhood, it will need to become more flexible in order to flourish. To his credit, David Cameron understood this. When he renegotiated the terms of Britain’s membership, he won an opt-out from the treaty commitment to “ever-closer union”, as well as wording that the treaties should not “compel all member states to aim for a common destination”. The European Commission and the French and German governments prevented Cameron from pushing further in this direction – and, in any case, the words agreed in February 2016 had no legal standing after the British referendum.

Nevertheless, the UK’s vote to leave has helped some policymakers recognise that in an EU of 27 members, with very different objectives, not everybody will be comfortable signing up to everything. Indeed, some projects – such as common defence – may work better with fewer countries involved.

If governments gained the freedom to opt in or out of certain policies, on a permanent basis, it would weaken the Eurosceptic narrative that the EU is an all-powerful juggernaut intent on imposing a uniform model of integration on to an entire continent. Even a federalist government such as that of Italy is sympathetic to extending the ideas that Cameron pushed for.

The European Commission president, Jean-Claude Juncker, in his March 2017 options paper, sketched a scenario in which “certain member states want to do more in common [and] one or several ‘coalitions of the willing’ emerge to work together in specific policy areas”.

Emmanuel Macron’s victory in France is likely to presage a less uniform EU. Together with Angela Merkel, who is expected to win Germany’s election in September, Macron plans to push ahead with eurozone integration. The eurozone will become more distinct from the rest of the EU, with its own institutions. Joining the euro will become an even more demanding undertaking than it is already. Sooner or later, most EU leaders will recognise that some member states are ill-suited to euro membership and that others – such as Sweden and Poland – will not want to join.

Two other related factors may encourage the EU to become more flexible. One is that EU enlargement has all but ground to a halt. The last country to join was Croatia, in 2013. The next one – perhaps Serbia or Montenegro – will be lucky to get in by 2025, if ever. Enlargement has stopped because in many EU countries voters do not want new entrants. The halting of enlargement has undermined the EU’s influence in the Balkans – where Russia and Turkey are gaining ground – and in eastern Europe.

The second factor is that the EU’s neighbourhood policy has largely failed. It was supposed to create a “ring of friends” around the EU, persuading neighbours to reform their economies and political systems by offering trade, aid, freer movement and stronger political ties. Yet the EU offered too little to motivate most of these countries to reform – with a few exceptions such as Georgia and Tunisia. Many southern and eastern neighbours have turned their backs on the EU rather than becoming its friends.

The way forward for the EU’s enlargement and neighbourhood policies is to invent new forms of partial membership. A decade or so ago, Merkel talked of offering Turkey a kind of half-membership called “privileged partnership”. This should be revisited. Voters in EU countries would be less hostile to enlargement if the candidates joined only certain policies – perhaps excluding, say, free movement. And if countries such as Morocco or Ukraine became eligible for partial EU membership, the gravitational influence of Brussels in its neighbourhood would grow.

The EU will want to be careful about preserving its legal order. Some non-members could be allowed participation in, for example, defence, trade or parts of the single market, so long as they accepted its rules and the jurisdiction of its courts. Full membership will have to entail a commitment to common trade, environmental and foreign policies and the single market. Members could be allowed to opt out in other areas, such as judicial co-operation, intelligence-sharing, corporate taxation or the euro.

This variegation would have implications for budgets and accountability, which is why Macron has asked for the eurozone to have its own budget and parliament. Poland and other central European states fear that, in a multitrack Europe, they will be treated as second class. Proponents of flexibility need to say that avant-gardes will not exclude any member wishing to join that meets objective criteria. And smaller groups should be transparent about what they do in order to ensure that a differentiated EU does not become a fragmented union.

In the long run, the EU is likely to become more flexible. This could have major implications for Britain, as well as others on the outside, such as Norway and Switzerland. At the moment, the chances of a post-Brexit Britain wanting to return as a full member seem minimal. But once they have experienced the chill winds of solitude, the British may wish to join an outer tier of the EU.

Charles Grant is the director of the Centre for European Reform