The populist right has wasted no time waiting for facts to emerge about the identity of the attacker in Berlin or a motive to slam Chancellor Angela Merkel for her humane asylum policy and to push its xenophobic agenda. This dangerous — if predictable — reaction plays directly into the hands of the Islamic State, which would like nothing better than to start a war between Christians and Muslims in Europe.
Shortly after the attack on Monday, Marcus Pretzell, a member of the far-right Alternative for Germany party, viciously tweeted, “These are Merkel’s dead!” On Tuesday, Geert Wilders, the leader of the Netherlands’ Party for Freedom, tweeted an image of Ms. Merkel spattered with blood; Nigel Farage, of Britain’s U.K. Independence Party, tweeted that such events “will be the Merkel legacy”; and Marine Le Pen, the French nationalist, issued a statement on the “Islamist” attack in Berlin and called for reinforcing Europe’s national borders there.
More may soon be known about the person who drove a truck into a Christmas market near Berlin’s Memorial Church, killing 12 people and injuring at least 48. A Pakistani immigrant detained after the attack was freed Tuesday, and the assailant, still unidentified, remains at large.
As the police asked the public to stay vigilant, Ms. Merkel, who said “we must assume” the attack was an act of terrorism, appealed to Germans not to let terrorism steal their way of life: “We do not want to live with the fear of evil paralyzing us.” Still, Christmas markets in Berlin remained closed on Tuesday. London’s Metropolitan Police assured that it had “detailed plans for protecting public events,” and France’s interior minister, Bruno Le Roux, said that after the attack, “security for Christmas markets was immediately reinforced.” Heightened fears across Europe are understandable; the attack resembled one on Bastille Day in Nice, where a truck was used to slaughter more than 80 people.
The Berlin attack risks igniting in Germany an already charged debate on refugees. “It would be particularly difficult for all of us to bear if it is confirmed that this deed was carried out by a person who sought protection and asylum in Germany,” Ms. Merkel said. Running for re-election next year, she is politically vulnerable, with mounting opposition to her government’s asylum policy. Last New Year’s Eve, assaults on women in Cologne by mobs of North African and Arab men set off outrage. In July, a 17-year-old Afghan refugee attacked passengers on a German train and a 27-year-old Syrian asylum seeker blew himself up in southern Germany, wounding 15 others, compounding public fears.
President-elect Donald Trump also jumped in on Monday, lumping the Berlin attack with the assassination on the same day of Russia’s ambassador to Turkey and an attack within hours at an Islamic prayer center in Zurich, tweeting, “The civilized world must change thinking!” That is the wrong response. The motivations for the attacks appear completely different. In Zurich, the assailant, a Swiss citizen of Ghanaian descent, opened fire on worshipers, wounding three, and was later found dead not far away.
Protecting the public and foiling terrorism in Germany and across Europe will require far greater cooperation on intelligence and policing among neighboring nations. That work will become even more urgent as the Islamic State, facing defeat in Syria and Iraq, trains its sights on Europe with new vengeance. But as governments expand counterterrorism efforts, as they should, they must also avoid tarring the vast majority of Muslims in Europe, whether recent asylum seekers or longtime residents, who are law-abiding people as vulnerable to terrorism as anyone else, and are now themselves the target of hate crimes.
With each new attack, whether on a Christmas market or a mosque, the challenge to Europe to defend tolerance, inclusion, equality and reason grows more daunting. If Europe is to survive as a beacon of democratic hope in a world rent by violent divisions, it must not cede those values now.
A version of this editorial appears in print on December 21, 2016, on Page A26 of the New York edition with the headline: A Cruel Test for Germany, and Europe.