Chancellor Angela Merkel opened Germany's doors to one million refugees and migrants last year - three times as many as the rest of the European Union put together.
Critics in Germany predicted a popular backlash, and warned that even her own Christian Democratic Party (CDU) would turn against her.
In the case of the CDU, at least, they were wrong. At the party's annual congress on December 15, Merkel's speech - in which she did not retreat one inch from her frequent assertion that "we can do it" (accept and integrate the refugees) - received a 10-minute standing ovation that brought tears to her eyes.
Despite a dip in the opinion polls, she also still enjoys widespread popular support - or at least she did until the ugly events in the city of Cologne on New Year's Eve.
In the crowds that gathered in front of Cologne's railway station to celebrate the New Year, hundreds of young men in gangs began harassing and robbing German women. "All of a sudden these men around us began groping us," one victim told German television. "They touched our behinds and grabbed between our legs. They touched us everywhere, so my girlfriend wanted to get out of the crowd. When I turned around one guy grabbed my bag and ripped it off my body."
There were 379 complaints to the police, 40 per cent of which involved sexual assault, and two accusations of rape.
Only 31 men were arrested in connection with these offences, a police failure that caused popular outrage. But the incendiary fact - which the police at first declined to reveal - was that 18 of the 31 men arrested were asylum-seekers, and all but five were Muslims. So there was a firestorm of popular protest about the Cologne attacks (which also happened on a smaller scale in Stuttgart and Hamburg).
But what on earth made those young Muslim men, the beneficiaries of Germany's generosity, think they could sexually attack young German women in public (and rob them while they were doing it)?
They were not professional thieves, and I very much doubt that they would sexually attack young Muslim women in public if they were back home. I suspect they were mostly village boys who still believe the popular Middle Eastern stereotypes about good Muslim girls whom you must not harass, and "loose" Western women who are fair game for sexual assault.
I once lived in Istanbul for a while with my wife and two little boys, and we had the same experience as most other Westerners: when my wife was out with me or with the children, she was treated with respect. When she was out alone, she was the target of constant sexual harassment.
At least once a day, as young men passed her in the crowded streets, she would suddenly experience the full frontal grab and if she protested, they would simply laugh at her. So I taught her what a Turkish woman would say if the same thing happened, and it did help. She still got molested, but when she rebuked the attackers in Turkish they were overwhelmed with shame and panic, and disappeared into the crowd as fast as possible.
This was back when Istanbul had only three million people (it now has 14 million), but already my Turkish friends were moaning about how their city was being "village-ised" by people migrating from the countryside. Even Turkish women who looked too "Western" were being harassed, and they blamed the ex-villagers.
When you take in one million refugees, that number of people will include a considerably larger number of ignorant hicks who think that it is not a crime or a disgrace to attack non-Muslim girls sexually.
No good deed goes unpunished, and this is part of the price Germany will pay for its generosity. It's not an unbearable price and in a couple of years most of the young Muslim men who attacked women in Cologne will have figured out that being free, as German women are, does not mean being immoral or freely available.