Dogs are more capable of understanding situations from a human's point of view than has previously been recognised, according to researchers.
They found dogs were four times more likely to steal food they had been forbidden, when lights were turned off so humans in the room could not see.
This suggested the dogs were able to alter their behaviour when they knew their owners' perspective had changed.
The study, published in Animal Cognition, conducted tests on 84 dogs.
The experiments had been trying to find whether dogs could adapt their behaviour in response to the changed circumstances of their human owners.
It wanted to see if dogs had a "flexible understanding" that could show they understood the viewpoint of a human.
It found that when the lights were turned off, dogs in a room with their human owners were much more likely to disobey and steal forbidden food.
The study says it is "unlikely that the dogs simply forgot that the human was in the room" when there was no light. Instead it seems as though the dogs were able to differentiate between when the human was unable or able to see them.
The experiments had been designed with enough variations to avoid false associations - such as dogs beginning to associate sudden darkness with someone giving them food, researchers said.
Dr Juliane Kaminski, from the University of Portsmouth's psychology department, said the study was "incredible because it implies dogs understand the human can't see them, meaning they might understand the human perspective".
This could also be important in understanding the capacities of dogs that have to interact closely with humans, such as guide dogs for the blind and sniffer dogs.
Previous studies have suggested that although humans might think that they can recognise different expressions on their dogs' faces, this is often inaccurate and a projection of human emotions.
"Humans constantly attribute certain qualities and emotions to other living things. We know that our own dog is clever or sensitive, but that's us thinking, not them," said Dr Kaminski.
"These results suggest humans might be right, where dogs are concerned, but we still can't be completely sure if the results mean dogs have a truly flexible understanding of the mind and others' minds. It has always been assumed only humans had this ability."