Contagious yawning is a phenomenon that most humans have experienced but its underlying cause still divides scientific opinion.

Far from being a sign of sleepiness or boredom, some researchers believe it is a mechanism to cool the brain which has been hard-wired into our systems from ancient times when groups needed to stay awake and vigilant.

Others think it is a result of unconscious herding behaviour which demonstrates empathy and signals that we are part of the group.

Now scientists have discovered that chimpanzees can also ‘catch’ the yawns of humans and other chimps in an intriguing glimpse into our shared ancestry.

And, in a hint that contagious yawning is important to group dynamics, researchers discovered they will not copy the yawns of an unfamiliar species, such as baboons or even chimps they do not know.

The researchers found chimpanzees showed contagious yawning when looking at familiar chimpanzees, familiar humans, and unfamiliar humans. But they ignored the signal from unfamiliar chimpanzees or an unfamiliar species (gelada baboons).

Dr Matthew Campbell of Yerkes National Primate Research Centre at Emory University, said: “Copying the facial expressions of others helps us to adopt and understand their current state.

“That humans known and unknown elicited empathy similarly to group members, and more than unknown chimpanzees, shows flexibility in engagement.”

In 2009 Dr Campbell and Frans de Waal published a study which showed contagious yawning in chimpanzees is not just a marker of sleepiness, but that it is a sign of a social connection between individuals.

A study by the University of Pisa in Italy in 2011 found that yawns are more contagious when they come from family or friends.

Humans are most likely to catch or pass on a yawn when interacting with close family members, followed on a decreasing scale by friends, then acquaintances and lastly strangers – the same pattern that is seen for other measures of empathy.

They found that half of all yawns are contagious between family members, compared with about a quarter of those between friends, an eighth between acquaintances and fewer than one in ten between strangers.

The results also showed that the delay in which a yawn is passed on is longer between strangers than between people who know each other well.