In the past few weeks, the Islamic State has sustained a string of military defeats: ousted from its refuge on the Libyan coast, struggling to maintain its hold on the Iraqi city of Mosul, and losing ground in Syria. Yet as the deadly truck attack on a Christmas market in Berlin made clear, those losses do not diminish the group’s extraordinary power to inspire terrorist mayhem around the world, and may even help fuel it.

In just the past year, even while under near continuous bombardment by the American-led coalition, the Islamic State has claimed responsibility for more than three dozen attacks, stretching across 16 countries on four continents.

That figure does not include the organization’s home terrain in Syria and Iraq, where it has lost 50,000 fighters in the past two years, according to the Pentagon — nearly as many dead as the United States lost in the Vietnam War. Many of the attacks beyond the Middle East were carried out by assailants who cited their inability to reach the group’s Syria refuge, its self-proclaimed caliphate, as a motive for acting at home.