BERLIN — AMID the staccato ping of news generated by Europe’s migration crisis, perhaps nothing is more jarring than what is playing out in Germany. The country, which expects up to a million refugees to arrive this year and whose chancellor has been the Continent’s most outspoken advocate for accepting refugees, has also experienced more than 200 attacks, mostly arson, on homes for asylum seekers during the first six months of the year, according to the Ministry of Homeland Affairs.

It feels like staring at a strobe light, this bounce between humanitarianism and terrorism. Many Europeans, and especially Germans, are watching with a sense of helplessness: Will our urge to help let loose our darkest demons?

The good news is that although there are problems with Europe’s immigration policy, the fixes are clear.

First, the European Union has to fix the so-called Dublin mechanism, which says that the member state where an asylum seeker first sets foot has the responsibility for processing his claim. This is a recipe for disaster: With most of the refugees coming from Africa and the Middle East, their first stops are usually Italy, Greece and other economically weakened Southern European countries.