In 2014, ISIS racked up a series of stunning successes as it pushed through Iraq and Syria, gaining momentum and new recruits with each victory. But in recent weeks, Syrian government forces liberated the city of Palmyra from ISIS, signifying a broader retreat for the extremist group over the past year. Can ISIS survive the label of loser?

Who could have foreseen that within a decade, between 2004 and 2014, the terrorist group al-Qaeda in Iraq would transform into ISIS, outline an apocalyptic vision of the End Times, reintroduce slavery, embrace war without limits, take on the world’s greatest powers, and conquer a mini-empire spanning swaths of Syria and Iraq—with spin-off affiliates infiltrating Libya, Nigeria, and elsewhere?

ISIS’s lightning advance may be partly explained by what psychologists call the “winner effect,” whereby the experience of victory raises the odds of further triumphs. In a wide variety of settings, success can have a catalyzing effect on champions. In mammals, winning actually affects the brain, boosting confidence and aggression, and potentially spurring more gains. Experiments have shown that when mice win a few fights against weaker opponents, their testosterone levels increase, and they become more likely to defeat stronger rodent adversaries. Similarly, with humans, winning can trigger a spike in testosterone for tennis players, wrestlers, and chess players alike, which can contribute to additional wins. Furthermore, success also has a positive impact on outside audiences. The “halo effect” refers to how people often view winning individuals or sports teams as bathed in an aura of virtue. People want to associate with a successful brand—for example, donors give overwhelmingly more money to elite universities than to other schools.

And so the secret of ISIS’s success is in large part winning itself. The extremists got on a roll, as victories drew recruits, demoralized opponents, and produced new triumphs. ISIS is, at its heart, a story, about a vessel of divine wrath cleansing a fallen world, propagated through the slickly produced magazine Dabiq, thousands of Twitter accounts, and the brutal propaganda of the deed. The group’s battlefield successes seemingly confirmed the narrative that the rise of ISIS was written in the stars by the hand of God. Winning made the incredible credible. For foreign fighters, the ISIS brand of faith, glory, fellowship, sex, murder, and torture, is far more compelling when glued together by victory. And as ISIS swept through northern Iraq, local fence-sitters prioritized their own survival and decided to back the winning team.

And then Islamic State’s Icarus flight suddenly stalled. By one estimate, since January 2015, ISIS has lost 22 percent of its territory, including the cities of Tikrit and Ramadi in Iraq, as well as strategic areas of northern Syria, which has limited the group’s capacity to sell oil across the Turkish border. In recent months, ISIS has largely been playing defense: It hasn’t launched a major offensive since last summer. It has been hit by the death of key commanders and an uptick in defections. U.S. officials claim that ISIS’s ranks are at their lowest level since 2014.

ISIS is especially vulnerable to the loser effect because of its claims of divine mission.

These could all be short-term setbacks before ISIS regains the initiative. But they may also signal a definitive turn of the tide. Fighting the entire world is not easy. Even holy warriors face the laws of military gravity. The anti-ISIS coalition has been hobbled by internal divisions. But the alliance of every global great power, and every regional power, has such an overwhelming advantage in firepower that even a modest improvement in cohesion is dangerous for the Islamic State. For several weeks, the Syrian regime and key rebel groups largely observed a truce, which allowed Damascus to turn its attention to Palmyra. ISIS only has a few tens of thousands of fighters. If the coalition follows an “anaconda plan” of squeezing the caliphate at multiple points simultaneously, ISIS can’t resist everywhere.

If ISIS retreats further, it may face a “loser effect” where failure causes a downward spiral. The experience of loss can be just as debilitating as winning is catalytic. For example, when animals repeatedly fail to complete a task, they may experience what’s called “learned helplessness” where they essentially give up, become passive, and fail to take opportunities even when they arise. Repeated debacles can also sap people’s confidence and make them feel resigned and hopeless. In addition, outside audiences may shun failed individuals or groups as if they are toxic. The “reverse-halo effect” or “horns effect” means that if we see a person or brand as negative in one respect, we often see them as bad in other unrelated ways.

ISIS is especially vulnerable to the loser effect because of its claims of divine mission. Nationalist groups like the Syrian Kurdish YPG represent a flesh-and-blood people. If the YPG is forced to retreat, and the homeland is threatened, its rallying cry may become even more compelling. But ISIS’s allure hinges on the authority of its religious claims. Withdrawal could bring into question Islamic State’s entire identity, triggering a crisis of confidence. Why would God’s chosen people be falling back before the infidels?

ISIS has multiple identities that allows the group considerable scope to reimagine the meaning of victory.

Successive defeats could cause ISIS to collapse far more quickly than anyone expects. Apocalyptic cults can quickly arise and then suddenly disappear. The Students of the Seven Seals (also known as the Branch Davidians), the Order of the Solar Temple, and Aum Shinrikyo, all burned brightly and then faded. ISIS is a far larger entity than any of these, but its demise could also be rapid. If the Sunni population of Syria and Iraq concludes that the Islamic State is a band of loser thugs, ISIS’s allies may abandon it and join the rival Jabhat al-Nusra group, fence-sitters may jump over to the government side, and the Islamic State’s fortunes may precipitously decline. After all, ISIS’s predecessor, al-Qaeda in Iraq, was nearly wiped out in 2007 and 2008 when Sunni tribes allied with the United States in the “Awakening” movement.

Can ISIS spin events as a victory? Establishing a caliphate was a risky move because it created a clear metric for success: territorial control, as embodied in its slogan “remaining and expanding.” If the caliphate grows, ISIS is winning. If the caliphate shrinks, ISIS is losing. It would be hard for the group to explain away the loss of Mosul, the group’s de facto Iraqi capital, or Raqqa, its Syrian one. Nevertheless, ISIS has multiple identities in addition to statehood—insurgency, terrorist group, cosmic warriors—that allows considerable scope to reimagine the meaning of victory. If ISIS loses territory in the Middle East, it can broaden the battlefield or adopt new tactics to keep the initiative.

The group has a history of responding to loss by aggression. By 2010, al-Qaeda in Iraq (by that time known as Islamic State of Iraq or ISI) had barely recovered from the near-death experience of the Awakening. The United States claimed then that 34 of the movement’s top 42 leaders had been killed or captured in just a three-month period, and only eight were still at large. The safe bet for ISI was to go to ground and recover its strength. Instead, when civil war broke out in Syria, the group decided to invade its neighbor. The assault widened the ranks of its enemies to include the Syrian regime as well as the rebel Free Syrian Army. But the move turned out to be a strategic masterstroke, as Syria provided a sanctuary for ISI to evolve into the much tougher entity ISIS—the Islamic State of Iraq and Syria.

The attacks in Paris, Istanbul, and Brussels may represent ISIS’s attempts to ward off the loser effect. When the caliphate was expanding, it was an unnecessary risk to strike Europe and incur retaliation that could threaten its hold on territory. But loss encourages people to gamble rather than accept a certain decline. Hitting the far enemy of the West can distract from failures against the near enemies at home. And so ISIS turned to its network of well-trained foreign fighters, which may number 400 on the European continent alone. Within hours of the attack in Belgium, ISIS had spread images of the bombings on social media.

ISIS is fighting not just to win, but also to define the meaning of victory.