Dogs do not like people who are mean to their owners and will refuse food offered by people who have snubbed their master, Japanese researchers have said.

The findings reveal that canines have the capacity to cooperate socially – a characteristic found in a relatively small number of species, including humans and some other primates.

Researchers led by Kazuo Fujita, a professor of comparative cognition at Kyoto University, tested three groups of 18 dogs using role plays in which their owners needed to open a box.

In all three groups, the owner was accompanied by two people whom the dog did not know.

In the first group, the owner sought assistance from one of the other people, who actively refused to help.

In the second group, the owner asked for, and received, help from one person. In both groups, the third person was neutral and not involved in either helping or refusing to help.

Neither person interacted with the dog’s owner in the control – third – group.

After watching the box-opening scene, the dog was offered food by the two unfamiliar people in the room.

Dogs that saw their owner being rebuffed were far more likely to choose food from the neutral observer, and to ignore the offer from the person who had refused to help, Fujita said on Friday.

Dogs whose owners were helped and dogs whose owners did not interact with either person showed no marked preference for accepting snacks from the strangers.

“We discovered for the first time that dogs make social and emotional evaluations of people regardless of their direct interest,” Fujita said.

If the dogs were acting solely out of self-interest, there would be no differences among the groups, and a roughly equal number of animals would have accepted food from each person.

“This ability is one of the key factors in building a highly collaborative society, and this study shows that dogs share that ability with humans,” he said.

The trait is present in children from the age of about three, the research papers said.

Interestingly, noted Fujita, not all primates demonstrate this behaviour.

“There is a similar study that showed tufted capuchins [a monkey native to South America] have this ability, but there is no evidence that chimpanzees demonstrate a preference unless there is a direct benefit to them,” he said.

The study will appear in the science journal Animal Behaviour to be published later this month, he said.