Loyalty to a football club is heightened by defeat as well as victory, a study has found.
The shared pain of losing binds fans together as much as the euphoria that comes with winning, say psychologists.
Despair and joy can be so intensely felt that both emotions cause fans to identify strongly with the club they support.
The phenomenon, termed "identity fusion", helps explain why fan loyalty is often so deeply entrenched, even when a club does nothing to deserve it in terms of winning games and trophies.
Powerfully negative experiences, such as a humiliating relegation, can actually help to reinforce support for a failing team, the research suggests.
Identity fusion may also bind terrorists together in a common cause or forge bonds between violent gang members, it is claimed.
Lead scientist Martha Newson, from Oxford University's Institute of Cognitive and Evolutionary Anthropology, cited followers of Leicester City as a good example of fiercely loyal fans who have stuck by their team through thick and thin.
The Foxes caused one of the biggest sporting upsets in history when they clinched the Premier League title last season, having narrowly avoiding relegation the season before.
Newson said: "Together, the fans have been on a journey where for many years the team didn't get the results. Then the club's fortunes soared, culminating in them celebrating the Premier League title.
"Our research suggests it is the intensity of emotion that counts, so their history of shared painful losses is as important as the joy of winning the league in creating 'self-shaping' experiences. These experiences lead fans to fuse their own identity with that of their club and fellow supporters."
Around 150 football supporters who followed a number of different performing teams from around the UK took part in the study, which was based on an online survey.
Using a seven-point response scale, fans rated how strongly they identified with their club and how loyal they were to it. They were asked to agree or disagree with statements such as, "I am one with my club" and "I could never stop being a fan of my team".
The extent to which supporters felt their identities had been "shaped" by both victories and defeats was also measured.
Previous research by Oxford University scientists has shown similar bonding between soldiers in military units and victims of traumatic events such as terrorist attacks.
Co-author Professor Harvey Whitehouse, director of the Institute of Cognitive and Evolutionary Anthropology, said the results had implications for dealing with terrorism, football hooliganism and gang violence.
He said: "We find that deeply unpleasant, painful shared memories can strengthen ties rather than breaking them. This has relevance for policy makers, for example, fighters in Syria experiencing the horrors of a bombing campaign may be bound together by these traumatic events.
"A similar mechanism might be responsible for creating ties between gang members who have shared violent experiences.
"We hope further research can shed light on how self-shaping mechanisms can be harnessed to produce more positive outcomes. The reverse might also be possible - that is it may be possible to 'de-fuse' individuals whose love of the group leads to acts of terrorism or possibly, in the case of a few football fans, fighting on the terraces."
The research is published in the journal Public Library of Science ONE.