Whether we realize it, African elephants (Loxodonta africana) are listening to us. The pachyderms can tell certain human languages apart and even determine our gender, relative age, and whether we’re a threat, according to a new study. The work illustrates how elephants can sometimes protect themselves from human actions.

“It is a most remarkable finding,” says Frans de Waal, a primatologist at Emory University in Atlanta. “Animals associating sounds with danger is nothing new—but making these fine distinctions in human voices is quite remarkable.”

Elephants in Kenya’s Amboseli National Park, where the study took place, are killed periodically by Maasai pastoralists. Maasai men sometimes spear the animals to protest park policies governing grazing and water rights, and sometimes in retaliation for tusking and trampling people or cattle. “Most of the time, the Maasai and elephants co-exist quite well,” says Karen McComb, a behavioral ecologist at the University of Sussex in the United Kingdom. “But spearings do occur, and it’s clear that the elephants are tuned into the Maasai in lots of ways.”

It’s long been known that elephants flee when they encounter Maasai men wearing their distinctive red robes—yet they are far less bothered by other people on foot. Indeed, other studies have shown that the animals even distinguish between the color and scent of clothing worn by Maasai pastoralists and Kamba men, farmers who live in the same area but don’t threaten the animals.

McComb and her colleagues wondered if the Amboseli elephants could make similar distinctions between the voices of the Maasai and Kamba people. The scientists recorded men from the two ethnic groups, as well as Maasai women and boys, saying “Look, look over there, a group of elephants is coming” in their respective languages. (A Maasai man speaks the phrase in the audio file above.) From a concealed loudspeaker, the team then played back the voice recordings to 47 elephant family groups (which are composed of related adult females and their dependent young) while observing and videotaping the animals’ reactions.

Right “from the get-go, the elephants responded differently to the Maasai and Kamba male voices,” says study co-author Graeme Shannon, a behavioral ecologist at Colorado State University, Fort Collins. They were more likely to retreat and bunch together, forming a defensive fortress around their young, and to smell the air (raising their trunks skyward) if they heard an adult Maasai man speak. But their reaction was not nearly as defensive when the voice was that of a male Kamba. The animals were also much less fearful when presented with the voices of Maasai women or boys. The scientists also altered the recordings, making the adult male voices sound more female and vice versa. But the elephants weren’t fooled and remained vigilant, the scientists report online today in the Proceedings of the National Academy of Sciences.

“Cognitively, they know what they’re doing, and they adjust their reaction to exactly what they’re hearing,” McComb says. In a previous playback experiment, she and her colleagues showed that elephants will often come aggressively toward the loudspeaker when they hear lions (their other predator) roaring, apparently to drive them off. But when the elephants heard the adult Maasai male voices, they never showed this mobbing behavior, and instead formed a defensive bunch and retreated stealthily.

And apparently because the Maasai men present such a serious threat, all the elephant matriarchs, including the youngest, knew how best to respond, the researchers say. “It’s a key skill,” Shannon says, “and is learned by watching; it’s likely not hardwired.” McComb adds that “older matriarchs appeared better at some voice discriminations—in particular, telling the difference between Maasai men and boys so that they only retreated when faced with men’s voices.”

“This study is one more confirmation of just how intelligent and flexible elephants are,” says Joyce Poole, an elephant expert with ElephantVoices in the Maasai Mara in Kenya. “I routinely tell the Maasai I work with that the elephants are studying us more carefully than we are studying them.” The work may be helpful in preventing “human-elephant conflicts where the species co-exist,” adds Joshua Plotnik, a behavioral ecologist at Mahidol University, Kanchanaburi, in Thailand. For instance, elephants might be deterred from entering farmland or encouraged to stick to the corridors designed for their use, Poole says. “The trouble is elephants are too smart to be fooled by us for long.”

Conservationists are also unlikely to be able to use the elephants’ language discerning abilities to stop the poachers armed with machine guns. “The elephants have learned what to do about Maasai men,” Shannon says. “But the Maasai spear only one elephant. Poachers gun down entire families. There’s little elephants can do about that.”