They revel in the good times and comfort in the bad, offering one another companionship and support, strength and protection. After all, what are friends for?

That is precisely the question that a devoted sector of scientists and behaviorists are puzzling to answer. But the friendships they are concerned with are not those that develop among humans, but rather those of the chacma baboons that inhabit southern Africa’s Zambezi region.

As NATURE’S Murder in the Troop shows, chacmas live in large troops, governed by strict hierarchical order, in which alliances and family ties are the foundation. Spending a large part of their day in close proximity to one another, they engage in a host of communal bonding rituals, from grooming to foraging to collectively caring for their young. These activities serve to strengthen their social network as they build trust within the troop and buffer against outside threats such as predators or rivals. It would seem there could be no safer environment in which to raise a family.

During grooming, the pulling of hair releases endorphins.

But there is a dark side to chacma society. Desiring to father their own offspring, highly aggressive alpha males often resort to infanticide — killing baboon babies that are still dependent on their mothers’ milk. A nursing mother will not come into heat, but without a baby to feed, she will stop lactating and once again become sexually available.

“Infanticide is common in chacma baboons,” says Dr. Ryne Palombit, Associate Professor at Rutgers University’s Center for Human Evolutionary Studies. He has been studying chacma baboon troops in southern Africa for over a decade. “It is usually perpetrated by a male who has recently immigrated into the group and has attained alpha status. That is not to say that all males who accomplish these two things always attack and kill infants.”

But the attacks occur often enough to shake the nerves of every new mother in a troop. In some years, Dr. Palombit has seen troops suffer an infanticide rate of up to 75 percent of all infant deaths. So, what is a mother to do in order to avoid the risk of her baby being killed? According to Dr. Palombit, those with young offspring often seek out friendships with males. “In chacmas, just about every lactating female has at least one male friend,” offers Palombit. “I think friendships are likely to reduce the risk of infanticide, and we’re trying to identify how that happens.”

A female will develop a bond with a male solely for the protection he may offer, especially when it comes to defending her baby from an attack. “We have data suggesting that although many males may rush over to an infant when the alpha male attacks it,” says Palombit, “it is usually only the male friend of the infant’s mother who will get involved directly and actively. For example, he’ll actually fight the attacking male or scoop up the infant and run off with it.” In some instances, a male consort may take on the role of foster parent after a mother’s death.

Friendships typically involve no sexual behavior, as lactating females almost never copulate. But the relationship can benefit the male in other ways. “The female invests heavily in the relationship by keeping in close proximity to him and grooming him,” says Palombit. Furthermore, a male may gain an advantage in joining a troop if he forms an association with a female on the inside.

As their hierarchical law dictates, chacmas typically consort with those only within their own rank. But females will sometimes seek friendships with males of higher rank, as they are usually more assertive in their behavior and therefore may offer more security. But Palombit is careful to note that despite social status, some baboons are simply better protectors than others.

While friendships with males may be useful in guarding against infant death, it is important to remember that in the wild there are no guarantees. Only a quarter of all chacma babies survive their first year. And when the worst happens, bereaved mothers turn to their female friends for comfort, often using the act of grooming as a tactile form of “grief therapy.” When the fur is stroked and pulled during grooming, endorphins are released, producing a natural high that relaxes the animal.

A 2006 paper published in Proceedings of the Royal Society of Biological Sciences underscores the important physical benefits of companionship in chacma society, especially during times of loss. In a 14-year study of chacma baboons in Botswana’s Okavango Delta, researchers regularly measured the levels of glucocorticoids, a group of stress hormones, in 21 females. In humans, these levels rise after the death of a close friend or relative. The baboons who had suffered losses were found to have elevated levels of the hormones as well. The study further indicated that after the death of a family member, females compensated for their loss by “reaching out” more than usual to other females. They increased their grooming rate and broadened their circle of grooming partners — even “breaking rank” to form alliances with those beneath them. Researchers believe that the contact serves as a coping mechanism for the baboons, as their glucocorticoid levels dropped significantly just after grooming.

Not only is this study the first to provide direct evidence that some animals mourn the loss of individuals, along with the work of Dr. Palombit and his colleagues, it illustrates how social bonds reduce stress and keep the troops cohesive.

Whether they involve fiercely defending each other or offering gentle and nurturing support, one thing is certain — friendships are vital to chacma society. And though we have not yet pieced together all the intricacies of their relationships, these baboons are giving us a pretty good indication of what friends really are for.