Humans have debated over the years whether animals have souls, personalities, or emotions — and while many of us have always known that dogs can sense emotion, new research provides some scientific basis behind it.

Researchers from the University of Lincoln in the UK and the University of San Paulo in Brazil delved into understanding how dogs can form a mental picture of sad, angry, or happy states in humans and other dogs by combining information from different senses. It’s the first time that researchers are hinting at the notion that a dog’s ability to sense emotion is embedded in its genetic code, rather than being a learned behavior based on environment. One past study, published in 2015, also found that dogs can differentiate between happy or angry faces — but they posited this was based on stored memories and training, rather than an inherent ability.

“[T]he dogs in our trials received no prior training or period of familiarization with the subjects in the images or audio,” said Daniel Mills, a professor at the School of Life Sciences at the University of Lincoln and an author of the study, in a press release. “This suggests that dogs’ ability to combine emotional cues may be intrinsic. As a highly social species, such a tool would have been advantageous and the detection of emotion in humans may even have been selected for over generations of domestication by us.”

For the study, the researchers paired images and sounds together, then exposed 17 domestic dogs to them. The images of faces and sounds of unfamiliar voices and barks exhibited either happy, angry, or aggressive emotions in both dogs and humans. The dogs spent more time looking at facial expressions that matched the emotions of the vocalization in both humans and dogs, proving that they used both their sense of sight and sound to tell who’s upset or happy.

The researchers found that dogs were able to recognize both facial expressions and vocalizations of happy or angry emotions. Image courtesy of University of Lincoln

“Our study shows that dogs have the ability to integrate two different sources of sensory information into a coherent perception of emotion in both humans and dogs,” said Dr. Kun Guo of the University of Lincoln’s School of Psychology, an author of the study, in the press release. “To do so requires a system of internal categorization of emotional states. This cognitive ability has until now only been evidenced in primates and the capacity to do this across species only seen in humans.”

To those of us who’ve watched videos of dogs cuddling fuzzy kittens or even cats caring for ducklings as their own, it’s not a surprise that dogs are able to recognize emotion in other species. And this perhaps can better explain why dogs (and sometimes cats, too) can be such a comforting presence as therapy.

The medical benefits of dogs extend to plenty of areas, from seeing eye dogs who guide the blind and manifest pure loyalty for their owners to dogs who are capable of sniffing out cancer. Canines have also been shown to boost owners’ immune systems, prod them into being more active, and even detect low blood sugar levels.

But perhaps the mental health therapy aspect of dogs is the most widespread. Research has found that therapy dogs (and normal dogs) can lower stress levels, reduce depression, and provide a soothing solace for trauma survivors or post-traumatic stress disorder sufferers. This latest study suggests that dogs’ emotional support and companionship may stem from an intrinsic ability to sense emotions, rather than simply being trained to do so. This is perhaps why they’re so effective as therapeutic agents.

Source: Albuquerque N, Guo K, Wilkinson A, Savalli C, Otta E, Mills D. Dogs recognize dog and human emotions. Biology Letters, 2016.