Crows are known to behave strangely around their dead: they gather around and squawk loudly nearby. 

The idea that it is part of some sort of ritual funeral has often been proposed.

But what they are actually doing has largely remained a mystery, as scientists had little to rely on except anecdotal evidence of such behaviour.

A team has now set out to unpick just why crows act so attentively around their fallen brethren. 

To do so, they set up an innovative experiment, capitalising on the knowledge that crows do not forget a threatening face.

This was discovered from earlier research. A series of studies led by John Marzluff of the University of Washington in Seattle, US, revealed that crows will remember an apparently dangerous individual.  

They then teach others to scold loudly at the dubious face in question, meaning a whole community of other crows also scold at that face several years later.

To prevent any real life harassment from crows, the face they used was not a real one but a rather realistic latex mask covering their real face. 

Using a similar disguise, researchers introduced a lone mask-clad individual to an area where the crows knew to expect a tasty treat from the experimenter, Kaeli Swift, also of the University of Washington. 

They would be holding a dead crow, palms outstretched like you might hold a plate of hors d'oeuvre.

By bringing treats, she played good cop. But the masked individual played bad cop, arriving on the scene holding up a dead crow. This sinister individual would remain in place for 30 minutes.

"I was always the friendly feeder, which was nice, I never made any crow enemies," says Swift. "I would put my food out, then this second person would show up.

"They would be holding a dead crow, not violently, not reenacting a death scene, just holding it like they were picking it up to throw it in rubbish, palms outstretched like you might hold a plate of hors d'oeuvre."

On the first day this masked person appeared, the crows avoided the food Swift had laid out altogether.

Instead they engaged in scolding and mobbing behaviours, when crows assemble in large groups to appear threatening to potential predators.

They know what death is and know to fear it

In this case, mobbing could have served more than one purpose, the authors report. This includes "chastising the predator, displaying dominance or social learning of the dangerous person or place".

If a hawk was placed next to the crow, they were even more likely to avoid the food, indicating they believed the hawk was the danger.

When the masked person returned the next day, even without a dead crow, they still avoided the food.

These results show that crows will avoid an area or thing that is deemed dangerous to their own species. In other words, they know what death is and know to fear it.

"It tells us that crows view death, at least in part, as a 'teachable moment' to borrow an anthropomorphic phrase. It's a signal of danger and danger is something to be avoided," explains Swift.

This work is another example of how crows have evolved to live so successfully with us

And this fear of a potential deadly situation stays with them. Even six weeks later more than a third of 65 pairs of crows continued to respond this way.

The study, published in the journal Animal Behaviour, was another in the line of research trying to better understand how animals respond to their dead. Western scrub jays, which are from the same bird family – corvids – have also been found to hold "funeral" type affairs when they see a fellow dead jay.

But whereas jays will also respond negatively to other species of dead birds of the same size, the crows did not. If the masked person held out a dead pigeon instead, the crows did not seem as bothered.

These findings highlight how important their memory is for learning and retaining the detail of human faces. It's a skill that helps them pick out threatening people from harmless ones.

"This work is another example of how crows have evolved to live so successfully with us," Swift told BBC Earth.

"They can learn our faces and do so in an impressive number of circumstances including when we have appeared to out ourselves as one of those prickly neighbours by interacting with their dead."

Crows are now the latest in the small group of animals that are known to recognise, or perhaps even mourn their dead. Elephants, giraffes, chimpanzees and several other corvid species are also known to loiter near recently deceased mates.

You can follow Melissa Hogenboom and BBC Earth on Twitter.