FOUR months ago, the body of three-year-old Aylan Kurdi washed up on a beach in Turkey after he, his brother and his mother drowned while trying to reach Greece. A photograph of Aylan quickly became the defining image of the masses of refugees fleeing Syria’s civil war. The picture helped cement a brief consensus that the Middle Eastern migrants risking death to get to Europe should be allowed in to apply for asylum. Angela Merkel, Germany’s chancellor, announced that her country would accept asylum applications from any Syrians who reached its borders. Much of Europe seemed on the verge of joining the project.

But Europe never joined. The task of absorbing the migrants has been left to Germany and Sweden, with a bit of help from the Netherlands and a few other countries. German and Swedish eagerness to welcome so many refugees has gradually been worn down. Now the events of New Year’s Eve in Cologne and other German cities may have buried it for good.

That night, gangs of young men, mainly asylum-seekers, formed rings around women outside Cologne station and then robbed and sexually assaulted them. More than 600 women reported to the police that they had been victimised. After Cologne, when Europeans think of refugees, many no longer picture persecuted families or toddlers. Instead they see menacing young men imbued with the sexism that is all too common across the Middle East and north Africa.

Sex and the citadel

Such fears, though overblown, are not absurd, and will not be allayed by pointing out that the alleged attackers in Cologne so far identified are mostly Moroccan or Algerian, not Syrian. There really is a cultural gulf between rich, liberal, secular Europe and some of the countries from which recent migrants come. It is impossible to conduct surveys in Syria right now, for obvious reasons, but a 2013 Pew poll of Muslims around the world makes sobering reading. More than 90% of Tunisians and Moroccans believe that a wife should always obey her husband. Only 14% of Iraqi Muslims and 22% of Jordanians think a woman should be allowed to initiate a divorce. And although Arab societies take a harsh view of sex crimes, women who venture alone and in skimpy clothing into a public space in, say, Egypt can expect a barrage of male harassment.

Seeking safety: A flow diagram of asylum applications and rejections Migrants are no more likely to commit crimes than natives. But it would be otherworldly to pretend that there is no tension between the attitudes of some and their hosts. European women cherish their rights to wear what they like, go where they like and have sex or not have sex with whom they please. No one should be allowed to infringe these freedoms. However, it does not follow from this that Germany was wrong to offer a haven to Syrian refugees. The moral imperative has not changed since Aylan washed up on that beach. Half of Syria’s cities have been blasted to rubble, hundreds of thousands of people lie dead and tens of thousands are starving in towns under siege. Thousands more refugees arrive in Greece every week. Those who would shut them out must explain where they should go instead. Rather than succumbing to moral panic, Europe needs to work out how to manage the flow of refugees and help them assimilate. A good place to start would be to insist that they obey the law. Police in Cologne clearly failed to take on the harassers. Perhaps they did not recognise what was going on quickly enough, or were afraid of being accused of racism. Or it may have been simple incompetence. Women have complained for years that German police are slow to stop sexual harassment in the drunken crowds at the Munich Oktoberfest. Whatever the precise nature of the failure, it needs to be fixed. Security cameras in public places would make it easier to convict those who hide in crowds—Germans should overcome their queasiness about such surveillance. With luck, the police will learn from their mistakes and work out how to prevent such incidents. Molesters should be punished. Asylum-seekers who flout the law should face prison or deportation. No one can be sent back to Syria, but Mrs Merkel is right to argue that Morocco and Algeria are safe enough (see article).

Europe's safe lists: Which countries does Europe consider safe for migrants to return to?

Work and family

When it comes to assimilating new arrivals, Europe could learn a thing or two from America, which has a better record in this regard. It is not “culturally imperialist” to teach migrants that they must respect both the law and local norms such as tolerance and sexual equality. And it is essential to make it as easy as possible for them to work. This serves an economic purpose: young foreign workers more than pay their way and can help solve the problem of an ageing Europe. It also serves a cultural one: immigrants who work assimilate far more quickly than those who are forced to sit around in ghettos. In the long run most children of migrants will adopt core European values, but the short run matters too.

Migrants who take the most hazardous routes into Europe, for example by crossing the Mediterranean in leaky boats, are disproportionately young men (see article). Overall they make little difference to Europe’s sex ratio, but in some areas and age brackets they may skew it. This is a problem—districts with more young single men than women are more prone to violence, especially if those men are jobless. That is why it is daft to restrict the ability of refugees to bring their spouses and other family members to join them, as Denmark’s government is now doing.

The process of absorbing refugees will be neither quick nor easy, but it is the right thing to do and will ultimately benefit Europe. Ideally, all European countries would do their part. It is scandalous that so few have agreed to take more than a handful of Syrians, and that European governments have yet to agree on a beefed-up border agency to police the EU’s external frontiers. Even in Germany, there is a risk that Mrs Merkel will be forced to abandon her policy of compassion. If she is to salvage it, she must take the lead again, spelling out how Germans can make Willkommenskultur work—and how the newcomers themselves must adapt to basic European values.