Angela Merkel was cast as the heroine of the refugee crisis last year, bravely throwing open Germany’s borders to desperate masses attempting to cross the Mediterranean.

By contrast, David Cameron and the UK more broadly was cast as the villain. Lurid (and false) claims we had taken in only around 200 refugees added colour to condemnation of the government’s decisions: the border at Calais would remain closed; the UK would only take a limited number of refugees directly from the region (not from other European countries); instead it would mainly attempt to help by supporting humanitarian relief in the region.

It took genuine moral courage to refuse to buckle in the face of enormous pressure. But the justification for the government’s position was strong.

First, the UK approach reduces the incentive to take the horrible risks associated with being trafficked across the Mediterranean. By contrast, the German approach of letting in all those who make it over increases the number who will try (and therefore the number who will fail and die in the attempt).

Second, European economies are not prepared to integrate so many migrants arriving over such a short period. The average number of years of schooling for a Syrian was reported at a little over seven years for men and five years for women in the UN Human Development Report 2015. Compare that to the UK, where the average number of years is around 13 years for men and women.

It is not even like those years in school are equally helpful in preparing for European labour markets. Syrians (and other migrants) have been prepared for a wildly less developed economy than those they are now entering (not to mention one that speaks a different language). Now they have to compete in economies where there is often a structural unemployment problem even for the existing (relatively well-educated) population.

It might be reasonable to expect those arriving now to accept poor jobs. They fled much worse than a bad job in Germany, after all. Will their children feel the same way? Or is there a serious risk that, if it takes more than a generation to catch up to European norms – replicating the sustained disadvantage we see in places like the poverty-stricken Parisian banlieues – it will feel like discrimination and exclusion?

Resentment at an inability to match their peers, combined with a host of cultural differences and the radicalisation in the region that must have affected (or could affect) many among the refugee population, is dangerous. The events in Cologne over the New Year do not bode at all well as an early indication of the tensions that might arise.

European leaders are now desperately trying to reverse course and adopt the kind of approach Cameron was castigated for. It will be much more difficult now. They are relying on a deal with Turkey which rewards its increasingly authoritarian government with cash and other concessions. The deal could require European border forces (or maybe militaries) to undertake the ugly task of evicting large numbers of refugees who thought they had made it to the promised land.

All of this matters for the UK because the Schengen crisis must now be confronted along with the aftershocks from the earthquake in the Eurozone. Resolving these crises is going to preoccupy the EU institutions, which will quite rightly consider drastic changes to construct a more durable settlement. That is likely to include further steps towards a single European state, which can pool resources to police a common border.

Cameron has been vindicated on the migrant crisis, but it has made his claim that voting to Remain in the EU will bring a neat continuation of the status quo even less tenable. If we are going to stay, we will need to live with a much greater degree of EU integration. It will be needed to cooperate in the face of the two great crises facing most other member states.

We will also have to accept a material risk that we might need to work with other member states led by equivalents of the French National Front. You cannot pick and choose who wins other people’s elections. The election of Syriza in Greece shows anything is now possible. If part of the new deal allows a lot more entry from Turkey, or it fails to stem the rising number of migrants, that will further discredit centrist European leaders.

It would be quite reasonable to instead conclude that we are going to be increasingly uncomfortable with the changes made to address the Schengen and Eurozone crises, which we have been fortunate enough to avoid. We might be better off leaving and providing what help we can from outside.