Elephants can tell whether a human is a friend or foe by their scent and colour of clothing, according to Fife experts.
St Andrews University researchers found that elephants could recognise the degree of danger posed by different groups of individuals.
The study found African elephants reacted with fear when they detected the scent of garments previously worn by men of the Maasai tribe.
Maasai men are known to demonstrate their virility by spearing elephants.
The elephants also responded aggressively to red clothing, which is characteristic of traditional Maasai dress.
However, the elephants showed much milder reaction to clothing previously worn by the Kamba people, agriculturalists who pose little threat.
The psychologists said they had expected to find elephants might be able to distinguish among different human groups according to the level of risk they posed.
They said: "We were not disappointed. In fact, we think that this is the first time that it has been experimentally shown that any animal can categorise a single species of potential predator into subclasses based on such subtle cues."
The researchers, Dr Lucy Bates and Professor Richard Byrne, first presented elephants with clean, red clothing and with red clothing that had been worn for five days by either a Maasai or a Kamba man.
They found that Maasai-scented clothing motivated elephants to travel significantly faster in the first minute after they moved away.
The elephants also travelled further in the first five minutes, and took significantly longer to relax after they stopped running away.
They then investigated whether elephants could also use garment colour as a cue to classify potential threat and found the elephants reacted with aggression towards red but not to white cloth. This suggested that they associated the colour red with the Maasai.
The researchers believe the difference in the elephants' emotional reaction to odour versus colour might relate to the amount of risk they sense in the two situations, encouraged by a particularly keen sense of smell.
"With any scent of Maasai present, fear and escape reactions seem to dominate anything else," said Dr Bates.
Professor Byrne added: "While elephants can undoubtedly be dangerous when they come into conflict with humans, our data show that, given the opportunity, they would far rather run away, even before they encounter the humans in person.
"We see this experiment as just a start to investigating precisely how elephants 'see the world', and it may be that their abilities will turn out to equal or exceed those of our closer relatives, the monkeys and apes," he added.
The study is published online by Current Biology and will appear in the 20 November print issue. ( BBC )