For a mother brown bear in Scandinavia, few sights are as terrifying as a strange male. Adult male bears are known to kill cubs that are not theirs—and sometimes the mother that defends them. A new study suggests that smart mama bears have found a surprising way to protect their young. To shield her cubs from male attacks, mom just has to raise them near an adult bear’s No. 1 enemy: humans.

“People fear bears,” says Marcus Elfström, a wildlife ecologist at the Norwegian University of Life Sciences (NMBU) in Ås, Norway, who was not involved in the research. But the new study shows that “vulnerable bears fear dominant [fellow bears] more than they fear people.”

Female grizzly bears and Scandinavian brown bears move away from male territory after giving birth, often choosing areas far from the best bear habitats. If a mother loses her cub, she soon goes into heat, so an infanticidal male has a good chance of impregnating her. When researchers in Sweden found some mother bears and their cubs living near human settlements, they wondered whether it might be a reproductive strategy—a way of protecting their young from killer males. After all, adult male bears don’t often venture near towns because humans are likely to kill them. If it was for safety, did the mothers’ strategy work?

To find out, researchers from NMBU tracked 30 GPS-collared mother brown bears in south-central Sweden from 2005 to 2012. Nineteen of the mothers successfully raised their cubs, but 11 lost their litters to infanticidal males. That’s in line with previous studies showing that some 35% of brown bear cubs in this region die every year, most of them from male attacks.

When the researchers examined where the successful mothers lived during the mating season, they found that they stayed close to human settlements, at a median distance of 783 meters, they report today in the Proceedings of the Royal Society B . Some bears stayed even closer. “They were clearly using the humans as a shield,” says Sam Steyaert, a wildlife biologist at NMBU and the study’s lead author.

The successful bear families also use clear-cut areas, where young trees and shrubs are thick. “These mothers select the densest vegetation, especially when they’re close to humans,” Steyaert says. “That way they can be very close to people, but the people don’t know they’re there,” potentially minimizing conflicts. Every year between August and October, people in the region hunt and kill bears, often close to homes and villages. But bear families—the mothers and the cubs—are not targeted.

The smart mother bears seem to have figured this out. They stay closer to human settlements during the most likely time of male infanticide, the mating season. “It’s surprising because it shows that female bears are smart enough to think way ahead,” says William Ripple, an ecologist at Oregon State University, Corvallis, who was not involved in the study.

In contrast, the mothers who lost their cubs avoided areas with human settlements, roads, and clear-cuts, and instead stayed in areas with tree-rich bogs and forest. They kept a median distance of 1213 meters from any human habitation—exposing their offspring to despotic males in the process.

The successful mother bears are engaging in a tactic found elsewhere in the animal kingdom: treating the enemy of their enemy as a friend. “That’s a well-established strategy in ecology,” says Scott Creel, a wildlife ecologist at Montana State University, Bozeman. “But this study reveals that such ‘double negatives’ can have a big effect on survival.”

The study also upends the long-held belief that some bears move close to human settlements because of easy access to food. The areas near homes and clear-cuts where the successful mothers live are much poorer in food quality than areas farther from human settlements. “They aren’t associating people with easily accessible food,” but with safety, Elfström says. That’s a difference wildlife managers should take into account when brown bears are spotted close to humans, he adds.

But the study may raise more questions than it answers, says Merav Ben-David, a wildlife ecologist at the University of Wyoming in Laramie, who was not involved in this research. “Is this a learned behavior? And what happens to the cubs that were sheltered near human settlements? Are they more habituated to people, and thus, at greater risk of conflict [with humans] as adults?”

All good questions, says Steyaert, who hopes that others will repeat his team’s study on other and larger brown bear populations.