If you were old enough to see a PG-13 movie in 1997, chances are you went to see Titanic. And chances are you cried. You might have even seen the film multiple times, doing your part to make it the highest-grossing sob fest in movie history. Now, a new study suggests why people want to see tragedies like Titanic over and over again: Watching dramas together builds social bonds and even raises our tolerance for physical pain.

“Why on Earth would we waste so much of our time and money going back to novels and films that make us cry?” evolutionary psychologist Robin Dunbar of the University of Oxford in the United Kingdom and his team asked at the beginning of the new study. In their previous investigations of group activities like dancing, laughing, and singing, they found that feel-good chemicals called endorphins were released in the brain, leading to increased pain tolerance and stronger bonds between participants. Endorphins are also released when monkeys and other nonhuman primates groom, suggesting that this mechanism has evolved to boost social ties, Dunbar says. Watching a tragic drama unfold in a theater might harness the same system, the researchers hypothesized.

So Dunbar and his colleagues recruited 169 people to watch Stuart: A Life Backwards. This made-for-TV film portrays the experiences of a disabled homeless man who was sexually abused as a child and struggles with lifelong drug use and imprisonment. He ultimately dies by throwing himself in front of a train. Based on a real man’s life, the story is “about as close to pure tragedy as Shakespeare,” Dunbar says. “People were leaving in tears.”

The researchers compared those viewers with a second group of 68 people who watched two rather sedate BBC documentaries: episode one of The Museum of Life—a behind-the-scenes look at the Natural History Museum in London—and Landscape Mysteries “In Search of Irish Gold,” which explores Irish geology and archaeology. Before and after watching the films, all participants took two tests: One measured their sense of belonging or bonding with their fellow audience members. Another was a measure of pain sensitivity, called the Roman chair, which Dunbar says is a well-established proxy for endorphin release. In it, participants brace themselves unsupported in a chairlike stance against a wall until their leg muscles burn painfully. The higher the endorphin level, the longer a person should be able to sustain the posture, Dunbar says.

Participants who had watched Stuart: A Life Backwards were able to maintain the Roman chair roughly 18% longer than they had in their initial baseline test, compared with those who had watched the documentaries, the authors report today in the journal Royal Society Open Science . They also found a parallel increase in the volunteers’ sense of social bonding that was not seen in the control group, suggesting that watching the drama—and not the duller BBC shows—had boosted group coherence.

The results are “quite interesting,” says Alexander Shackman, a neuroscientist at the University of Maryland, College Park, who was not involved with the work. Still, the fact that the Roman chair pain sensitivity test did not directly measure endorphin release leaves open the possibility of other explanations for the increase in social bonding, he says. “We know that emotional films can have complex effects on the brain and that a number of other, nonopioid mechanisms can influence pain tolerance.” Other neuropeptides such as oxytocin, for example, also play a role in social bonding.

Not everybody responded to Stuart: A Life Backwards, Dunbar notes—indeed, for about one-third of the people, watching the film did not increase their sense of bonding and actually made them more sensitive to pain. That is not surprising considering individual taste, Dunbar says—after all, not everybody liked Titanic. Still, the findings may help explain the heightened sense of connection that people often feel as they exit a theater after seeing a powerful performance, he says. “As they come out into the foyer, they’re talking to complete strangers.” There’s an old adage in the theater community that sums up the phenomenon, Dunbar says: “People go into a play as individuals, and come out as an audience.”