On the Day of Ashura, Shia Muslims around the world gather to mourn the Imam, Husayn ibn Ali, and his defeat in the battle of Karbala (in present-day Iraq) in 680AD. They slash their heads and backs using swords or iron chains with blades until the streets are covered in blood. Every Good Friday, Catholics in the Philippines re-enact the suffering of Jesus Christ. These devotees are voluntarily crucified by having nails hammered through the palms of their hands and their feet. And every October, thousands of people converge on Phuket in Thailand to celebrate the Vegetarian Festival in veneration of Chinese deities and ancestors; practitioners remove parts of their skin, perform bloodletting, and impale their cheeks and limbs with anything from knives and skewers to antlers and umbrellas – all while burning firecrackers are tossed at them by the crowd.

Widespread participation in such voluntary rites over millennia of human history raises an important evolutionary question: Given the high cost, why does the practice go on? To find out, I’ve spent the past decade exploring ritual traditions around the world. My first destination – a literal trial by fire – took me to the rural parts of southern Europe where fire-walking has been performed for centuries. In Greece and Bulgaria every May, a number of Orthodox communities called the Anastenaria walk barefoot on burning coals to celebrate two Christian saints, Constantine and Helen. And in Spain, the residents of a small village in the central province of Soria stage a fire-walk on the night of the summer solstice. The origins of those rituals are lost in time, reaching at least as far back as the Middle Ages (some even place their dawn in prehistory, but evidence is lacking). And in the case of the Anastenaria, their perseverance defied not only the passage of time but also historical adversities such as the uprooting of their communities after the Balkan Wars and centuries of persecution, often violent, by the Greek Church.

To learn why such costly practices have endured, I started by doing what anthropologists do: I asked the locals. For more than two years, I had fascinating conversations, met interesting people, heard about extraordinary experiences, conducted hundreds of interviews and made great friends. But the answers I got were often perplexing. Some described feeling an undefined ‘urge’ to participate, while others said: ‘We don’t think about our rituals, we just do them,’ or simply: ‘It’s always been done that way.’

In Greece, people referred me to the most senior members of the community, but even the elders had reached no consensus on the importance of the rite. Some argued that fire-walking was done to ensure a good crop; others that it was done to heal the ill, to ask the saints for good fortune, or to thank them for providing for their devotees. Yet others would serve up ancient myths, such as: ‘Our ancestors once emerged unscathed from within a burning church, so we fire-walk to commemorate that event.’ Gradually, I realised that people don’t always know why they perform their rituals, and yet those rituals are of central importance to their lives. What was going on?

Part of the explanation might be found in cognitive dissonance theory, which holds that when the cost or effort spent in pursuing a goal is disproportionately higher than its rewards, the discrepancy (or dissonance) will tend to create mental stress or discomfort. In order to resolve this dissonance, we often attribute greater importance to the goal, a phenomenon called ‘effort justification’. In a classic psychology experiment conducted in 1959, the psychologists Elliot Aronson of Stanford and Judson Mills of the United States Army found that people who had to go through a highly embarrassing situation in order to join a discussion group subsequently reported liking the group more. In a follow-up study, researchers used electric shocks, and found that those who received severe shocks before entering the group valued their membership more than those who received merely mild ones.

pain or fear, typically thought of as negative, can be transformed into pleasurable experiences – akin to the thrill of the bungee-jumper

Across cultures, people are first drawn into ritual events for no particular reason. Most often, they simply follow their parents or peers. Other times, they might be motivated by curiosity or the need to belong. But whatever the reason behind their initiation, as participants invest more time, effort and resources in these activities, the act of participation itself makes them feel more meaningful and important.

There are, of course, a variety of other factors that contribute to the popularity of risky rites. For one thing, repetitive and predictable ritual patterns might help soothe anxiety and offer a sense of control when the future looks ominous or uncertain. The Polish anthropologist Bronisław Malinowski described in Argonauts of the Western Pacific (1922) how the fishermen of the Trobriand Islands performed a variety of magical rituals before going fishing in the dangerous waters of the open sea where the results were unpredictable, but didn’t do so before fishing in the calm waters of the lagoon, which guaranteed an easy catch.

Another clue comes from neuroscience. As rituals become more arousing, they trigger hormones that stimulate the reward systems of the brain. Sensations such as pain or fear, typically thought of as negative, can be transformed into pleasurable experiences – akin to the sharp thrill experienced by the bungee-jumper – through a spike in the neurotransmitter dopamine. An increase in neuropeptides called endorphins, which bind to the brain’s opiate receptors, produce the same soothing euphoria felt by the marathon runner (the ‘runner’s high’).

Yet these psychological and physiological insights get us only so far, especially when it comes to more extreme rituals such as fire-walking, which push the limits of human endurance by imposing extraordinary pain, stress and risks. Thus, the evolutionary puzzle remains. Why would such costly practices have survived throughout human history, unless they offered some social benefits?

The French sociologist Émile Durkheim argued in Elementary Forms of Religious Life (1912) that the collective performance of ritual generates a kind of ‘electricity’, an ecstatic state of shared excitement that he called ‘collective effervescence’ (think of a rave party). According to Durkheim, those collective events result in the alignment of emotional states, producing a sense of belonging and assimilation in all participants, who feel and act as one. In other words, the rituals serve as a kind of social glue.

Durkheim’s insight was revolutionary, but could we define or measure this togetherness, and what were the underlying biological and psychological mechanisms behind these effects? No one really knew, largely because researchers interested in ritual behaviour were divided into two methodological camps, each possessing only part of the toolkit required to drill down.

One camp, mostly consisting of anthropologists such as myself, try to understand human behaviour by immersing themselves in the everyday life of small social groups for extended periods of time, an approach known as participant observation or, in the words of the US anthropologist Clifford Geertz, ‘deep hanging out’. Through this process, ethnographers manage to get first-hand experience and a wealth of insider information about wide-ranging aspects of life. But the data is often subjective and hard to organise systematically or investigate experimentally. In other words, it specialises in a type of knowledge that is ‘a mile wide and an inch deep’.

The other camp, mostly consisting of psychologists, relies on experimentation and quantitative research using numerical data and statistical analysis. Those researchers typically invite subjects to spend a very short time in a laboratory setting, where they look at specific aspects of their behaviour and cognition in an artificially controlled environment – an ‘inch wide and mile deep’ type of knowledge. For example, a number of neuroimaging studies have asked people to meditate inside a brain scanner and then examined the brain areas activated during meditation. Such methods allow researchers to test specific predictions with great precision, but the situations are often so unnatural and out of context that results can be dubious – people do not naturally meditate inside a large, noisy, claustrophobic electromagnet.

This problem is particularly pronounced when it comes to rituals, which are inextricably connected to specific places and special meanings that cannot be reproduced in a laboratory. For instance, the most important Muslim ritual (the Hajj pilgrimage) requires a trip to Mecca, while the largest Hindu ritual (the Kumbh Mela) requires bathing in the Ganges river.

As someone trained in both ethnographic and experimental methods, I knew that each approach required support from the other, and I thought I had a way to make it work: instead of taking people out of their natural context and moving them into a sterilised laboratory setting, why not immerse the laboratory in the context by moving it into the field?

To carry out my plan, I turned to a small Spanish village called San Pedro Manrique, home to the largest fire-walk in Europe. This ritual takes place on the shortest night of the year, June 23, and is part of an eight-day-long festival of San Juan. The festival includes both Catholic and secular events, and the paso del fuego (Spanish for fire-walk) is performed by religious people and atheists alike. The tradition is held sacrosanct by the locals, who consider it an inextricable part of their personal and collective identity. A fire-walker features prominently on the village’s most sacred symbol, its flag. The recinto, an amphitheatre built specifically to host the fire-walk, is the biggest public structure in the area. After all, as people kept reminding me: ‘San Pedro would never be San Pedro without the ﬁre-walk.’

‘Stomp on the fire using your entire foot … walk straight and look straight … respect the fire, but do not be afraid of it’

Many collective rituals involve synchronous movement, known to boost social cohesion. Studies conducted independently by the psychologists Frank Bernieri at Oregon State University and Michael Hove at Cornell found that when subjects moved in synchrony, they reported greater social rapport. Emma Cohen and fellow anthropologists at Oxford University found that rowers rowing in synchrony produced elevated levels of endorphins, long associated with social bonding. But are these bonding effects due simply to the fact that people perform the same movements at the same time, or to shared emotional states stirred up through empathy and contagion?

The village of San Pedro Manrique was ideal for exploring this distinction, because its fire-walking ritual was not performed in synchrony – fire-walkers crossed the fire one by one. If collective effervescence was more than an automatic effect of concurrent movement, then the very structure of the ritual should cause states of emotional arousal (for example, heart rates) to be synchronised across participants regardless of their bodily activity.

Coordinating an experiment in this setting, complete with specialised equipment, was no trivial task. In 2008, I assembled a team of nine researchers from the humanities and the sciences, bringing expertise in areas as diverse as medicine, anthropology, religious studies, filmmaking, and neuroscience. After months of testing and preparation at Aarhus University in Denmark, we arrived in Spain equipped with 40 high-precision, portable heart-rate monitors that could be worn unobtrusively under clothes, invisible to observers. We placed those devices not only on active fire-walkers, but also on spectators with various degrees of social affinity to them – relatives and friends, acquaintances, and even strangers.

As we worked behind the scenes, the village buzzed with excitement. More than 3,000 visitors (five times the local population) had gathered from near and far to watch the spectacle. The locals were dressed up, most of them wearing red and white, the village colours. At the centre of attention were three young girls called the móndidas. Those girls, chosen by ballot every year, are the official hostesses of the festival and the first ones to be carried over the fire (yes, the fire-walkers also carry a person on their back during their ordeal!). They, and everyone else, had been preparing for this day all year. In an interview, San Pedro’s mayor said he considered that year’s fire-walk the highlight of his 22-year mayorship, because he would finally get to carry his daughter over the fire.

After sunset, the crowds of locals and visitors started flooding to the town hall square. People were drinking and dancing, and the atmosphere was festive. But the fire-walkers were among the last ones to show up. They had spent the evening with their families, getting ready for their big night. No physical preparation is required, but having a clear mind is crucial. Temperatures are extreme and the experience of walking over burning coals can be painful. The pace must be controlled with precision. Walk too slowly and you’ll prolong contact with the fire, which is guaranteed to cause a nasty burn. Try to run and you’ll push deeper into the coal bed, where temperatures are even higher. Go toes-first and you could get pieces of burning matter stuck between your toes. Put too much weight on your heels and you’ll reduce the surface area of the impact point, plunging deeper into the hearth. The more experienced fire-walkers advise the youngsters, who listen in awe and anticipation: ‘Stomp on the fire using your entire foot … walk steadily and confidently … walk straight and look straight … respect the fire, but do not be afraid of it.’

A fire-walker carries a woman on his back across burning embers during the night of San Juan in San Pedro Manrique in northern Spain. Photo by Cesar Manso/Getty

At last, the vibe around the square began to change. No particular person was in charge, but everyone seemed to know exactly what to do. Like an orchestra without a conductor, the fire-walkers assembled out of nowhere, holding hands to form a big circle, several metres around. Unknowingly, I found myself inside the circle alongside the local band and those who would be carried over the fire. ‘Stay here and you will get a good spot,’ one of the fire-walkers told me. Soon, we were moving; in fact, we were jogging – almost running – up the hill towards the recinto, followed by the crowd.

Ten minutes later, we entered the central stage of the recinto while the crowd took its place on the tiers. At the centre of the stage was a ferocious fire pit, seven meters long and more than 20 centimetres deep. Over the course of the evening, it had consumed more than two tons of oak wood before being reduced to a carpet of glowing coals radiating unbearable heat at a distance of several metres. Using a pyrometer (a thermometer designed to withstand extreme temperatures), we measured the surface temperature of the coals at 677 degrees Celsius (1250 degrees Fahrenheit).

Still holding hands, the fire-walkers danced in a circle around the fire as the crowd cheered and sang to the tune of a local band. Soon the music stopped and everyone took their positions. The fire-walkers removed their shoes and nervously sat on the ground facing the fire. They were men and women of all ages and backgrounds: teenagers and retirees, farmers and housewives, the local mayor and the priest. The one thing they had in common was that they were all born in the village. Opposite them, across the fire pit, were their closest relatives, their soon-to-be passengers, and various people with cameras, including myself. And then there was silence. It was now exactly midnight.

One by one, each fire-walker stood up and fetched the person who was going to piggyback on them through the fire. Carrier and passenger stood in front of the fire waiting for their signal. You could cut the tension with a knife. The long burst of a trumpet summoned each pair to their ordeal, and off they went. Crossing the fire lasted only a few seconds, but to them it must have felt like an eternity. The slightest mistake, a simple slip or a misstep, could result in serious injury for the carrier as well as the passenger. Those few seconds could make the difference between a glorious victory and a tragic disaster in front of thousands of onlookers. After each successful crossing, feelings of relief and satisfaction kicked in as the crowd cheered frenetically and their families rushed over to offer a celebratory embrace with tears of excitement in their eyes.

The end of the fire-walk signalled the beginning of a huge party, of the kind only Spaniards know how to throw. Music played, food was served and wine flowed until morning. Everyone seemed to be having a great time, but my team and I were anxious to see what our devices had recorded. When we analysed our data, the findings were fascinating, not only for us but also for the participants.

A fire-walker’s heart-rate patterns resembled those of his wife more than those of his friend, and those of his friend more than those of a stranger

Our measurements showed that the fire-walk was the most arousing part of the day for each and every one of them, with heart rates often approaching 200 beats per minute. In fact, two thirds of our participants exceeded the conventional safe maximal level of arousal. In other words, this ritual was enough to give them a heart attack! This was not exactly unexpected, but it contrasted sharply with our participants’ own experience. When we asked them to provide subjective ratings of their physiological arousal throughout the event, they claimed that they were completely calm when they crossed the burning coals, and that the fire-walk was the lowest point of arousal for them. In fact, some of them challenged me to bet money on their assessments, claiming that their heart rates would be higher during the interviews than when they went through the fire. But their estimates could not have been further from reality. When we probed their memories of the event, we found that they had blacked out during the time of the fire-walk. Just as often occurs when being attacked in battle or by a shark, the extreme arousal had caused the memories of this traumatic event to be repressed.

But what about the idea that the ritual could produce shared physiological alignment among those moving in synch with each other? What would we find among our solo fire-walkers and the cheering crowd? Once more, the results were stunning, revealing an astonishing level of synchrony in heart-rate activity, extending from fire-walkers to spectators of the event. Indeed, when we mapped the social network of our subject pool, we saw that the degree of synchronicity was directly related to the level of social proximity. A fire-walker’s heart-rate patterns resembled those of his wife more than those of his friend, and those of his friend more than those of a stranger. In other words, the closer the social ties between two people, the more their heart rhythms were synchronised. This relation was so strong that we were able to predict people’s social distance simply by looking at the similarities between their heart-rate patterns.

These findings showed that there is indeed togetherness in collective ritual. Our participants explicitly talked about the bonding effects of the fire-walk, about how it makes them ‘feel like one’. But does this togetherness translate into some concrete social benefits, and how could we find out?

To answer this question, I set out to study other extreme rituals around the world.

The Thaipusam, a religious festival in honour of the Hindu war god Murugan, includes one of the most widespread extreme rituals known. Involving piercing and body mutilation, the ritual is practised in India and around the world by Hindu members of the Tamil diaspora (those originating from the state of Tamil Nadu). To study the effects of this ritual, I established a field site in Mauritius, a tropical island in the Indian Ocean with a Hindu majority.

On the day of the full moon in the Tamil month of Thai (January/February), people from all parts of the island flock to a small river at dusk to perform cleansing rituals and prepare for their ordeal. Over the previous 10 days, devotees have been fasting, attending daily prayers, steering clear of impure acts and thoughts, and sleeping on the floor. But these minor hardships are nothing compared with what is about to follow: devotees have their skin pierced with sharp metal objects, varying from a single needle through the tongue to hundreds of piercings covering every part of their bodies, including thick skewers the size of broomsticks perforated through both cheeks. For hours on end, the river bank echoes with the screams of those being pierced and the empathic cries of their beloved ones.

Once the piercings are in place, devotees set out on a long procession to the temple of Murugan, walking barefoot on scorching asphalt under the midsummer sun of the tropics. Those not barefoot walk on shoes made of nails. On their shoulders they carry elaborately decorated bamboo canopies called kavadi (the word literally means ‘yoke’ or ‘burden’), which can weigh up to 30 kilograms (66 pounds). Some of them also drag behind them chariots by chains attached to hooks through their skin. These chariots are often the size of automobiles and can weigh hundreds of kilograms. The procession lasts five hours or more, during which participants do not eat or drink anything and never let go of their burden. And when they finally reach the temple of Murugan, they must climb 242 steps up the mountain in order to offer their kavadis to the deity.

While almost everyone in the community celebrates the 10-day Thaipusam festival, participation in the painful kavadi ritual is optional. Relatives of the bearers and others can walk in a supportive role alongside or behind the procession, while others simply engage in gentler rituals such as collective prayer.

The more pain devotees felt, the more money they gave to charity

This diversity of roles provided the perfect context for exploring my question: how does the intensity of the ritual itself impact on social behaviour and empathy? To find the answer, we set up a lab equipped with portable computers near the temple. Immediately after the performance of each ritual, we randomly invited a number of devotees to take part in our experiment.

As participants entered the lab, they were asked to fill out a short questionnaire on a computer. Upon completing the survey, we thanked them for taking part in the study and offered them 200 rupees (a substantial amount equivalent to a couple of days’ wages for an unskilled worker) as compensation for their time. But before they left the area, an assistant informed them of a charity and asked them whether they would like to make a donation from their earnings. Their choice was entirely anonymous, but our experimental design allowed us to connect individual donations to survey responses.

The results were once more illuminating. Those who had participated in the extreme ritual gave twice as much as those who had taken part in collective prayer. Strikingly, we found the same high levels of generosity among those who had themselves gone through the painful activities of the kavadi and those who had merely followed the procession without engaging in self-torture. Just as we expected, this painful ritual boosted prosocial behaviour for its participants. And just as our Spanish study had led us to suspect, these effects extended beyond active performers to the entire community.

To examine the effects of ritual intensity more closely, we looked at how painful the experience was to each participant. We found a direct relationship between the reported painfulness of the ordeal and the amount donated. The more pain devotees felt, the more money they gave to charity. And this was true even among observers: the more painful they perceived the ritual to be, the bigger their donations. This pointed directly to the mechanism driving the prosocial effects of extreme rituals: extremity itself. In other words, the more painful these rituals, the more effective they are in fostering social cohesion.

It looks like the early anthropologists were right all along: extreme rituals contain an ancient recipe for community. We tend to avoid pain and suffering at all cost but, as soldiers sharing gruesome circumstances in the battlefield already know, the bonding effect is profound.

Some of the social consequences of suffering have already been documented at the individual level. In 2011 the psychologists Christopher Olivola of the University of Warwick and Eldar Shafir of Princeton demonstrated what is known as the ‘martyrdom effect’. In a series of experiments, they asked participants to raise money for various charities and found that people donated more when they expected to suffer more – for example, running five miles versus attending a picnic.

Our Mauritian study demonstrated this effect in a real-world setting, using real pain. But a recent experiment conducted in the Czech Republic by my colleague Radek Kundt of Masaryk University shows that this effect can work both ways. In that study, the experimenters used physiological arousal (through intense physical exercise) to produce either prosocial or antisocial behaviours among the participants, depending on the stimuli that followed that arousal. Participants who played a video game where they had to save the characters became more prosocial as arousal increased. But those who had to kill the game characters became more antisocial as their arousal went up.

Dancing, jumping, chanting and even suffering as part of a crowd awakens our most primitive social instincts

When performed collectively, these effects become even stronger. Empathic reactions to the suffering of others and the joint experience of suffering forges strong communal bonds. As the Spanish fire-walkers told me, when you perform this ritual, ‘everyone is your brother. The next day, you see another fire-walker in the street, and you know you’ve been through this together, you’ve bonded, you have a different relationship to this person.’ The cumulative effects of this transformative process can cement the social fabric of these communities. Collective arousal plays an important role in shaping social behaviour and identity. Communal symbols and narratives foster this sense of shared identity even further, demarcating the group from outsiders: ‘our team’, ‘our religion’, ‘our nation’. This ‘us versus them’ attitude, which can provoke hostility to outsiders, is the flip side of collective arousal. Coupled with an ideology, arousal can be a powerful social force, for better and for worse.

The recipe for extreme ritual, a source of shared empathy and arousal, has survived for millennia in ancient and more modern forms. Today, participants in the San Fermín festival in the Spanish town of Pamplona risk their lives to experience this thrill by running in front of massive bulls on the loose in narrow cobbled streets. Around the world, people pay exorbitant prices to attend musical concerts in overcrowded, unhygienic venues with terrible acoustics, when they could get much better audio quality anytime, free of charge and hassle. We travel great distances to attend football matches, often facing long queues, bad weather and obstructed views, when we could enjoy high‑definition video with multiple replays without leaving the sofa. The appeal of the live experience does not lie in the quality of the product but in the behaviour of the audience itself. Dancing, jumping, chanting and even suffering as part of a crowd awakens our most primitive social instincts, producing that transcendent feeling of losing oneself into the group that Durkheim called ‘effervescence’.

Most often, social cohesion is not the conscious goal: people all over the world subject their offspring to painful religious initiations such as circumcision not because they wish to make them more prosocial, but simply because these rituals ‘have always been done this way’. College fraternities organise hazing rituals to initiate their members not because they want to induce cognitive dissonance but because, well, that’s what fraternities do. Yet we often recognise and harvest the community-making potential of high-arousal rituals. Marine corps use hellish group training regimes to create unity among their troops; street gangs employ death-defying initiations to ensure the loyalty of new members; and the Firewalking Institute of Research and Education in the US offers walking on burning coals and other hardships as corporate team-building experiences.

Extreme rituals are powerful social technologies, and like all technologies they can be used to change our world for better or for worse. One important takeaway is that when ideology and collective arousal merge, emotional reactions can spread like wildfire through a crowd. But by tapping some of the same guidelines found in ritual arousal, we could harness the positive outcome and prevent vandalism, rioting, lynching and other forms of violence that can also result. By understanding the apparent connection between suffering and prosociality, we could design kinder communities, more empathic work places and more efficient charities. The enormous success of the ice-bucket challenge, which involves pouring ice-cold water over one’s head to encourage donations for research on amyotrophic lateral sclerosis (ALS), is due to the unpleasant nature of the activity – would a ‘drink a cup of cocoa’ challenge work as well?