Dogs have become more intelligent, and even learnt a sense of right and wrong, through spending time with humans, a study shows.

Although still controversial, recent research is beginning to support the view that an owner is perfectly correct when they pat their pet and coo "who's a clever boy then?"

Because of the way owners have selected smarter and more empathic dogs down the generations, these pets now appear to have a limited "theory of mind", the capacity that enables us to understand the desires, motivations and intentions of others, New Scientist reports today.

A decade ago, most scientists would dismiss the claims of dog owners that their precious pets could experience pain, excitement and other "human emotions" as sentimental claptrap that anthropomorphises the abilities of animals.

Now that dismissive view has been challenged by studies presented a few weeks ago at the first Canine Science Forum in Budapest, Hungary, which back the idea that the 10,000 years that the descendants of grey wolves have spent evolving alongside humans have had a remarkable effect on dog cognition.

In a remarkable experiment to probe canine cognition, Prof Ludwig Huber and colleagues at the University of Vienna put dogs through a classic experiment done with children in which an instructor demonstrates to a toddler how to turn off a light using her forehead, once with her hands clearly visible and once when wrapped in a shawl, so that she can't use them.

When invited to turn the light off for themselves, toddlers who were shown the first version use their heads, but those shown the second use their hands.

The standard interpretation is that the first group conclude that there must be a good but non-obvious reason for using the forehead method, as otherwise the instructor would have used her hands. Dogs do the same thing in Prof Huber's experiments, where they had to pull a lever to obtain a reward, lending support to the idea that dogs have a rudimentary "theory of mind."

They possess a moral compass too, in order to negotiate the complex social world of people, adds Prof Marc Bekoff from the University of Colorado at Boulder.

He argues that the fact that rough-and-tumble dog play rarely escalates into full-blown fighting shows that the animals abide by rules and expect others to do the same. In other words, they know right from wrong.

Dr Friederike Range from the University of Vienna, Austria, has found in experiments where one pooch was given a treat and another denied it that dogs possess a sense of fairness too, though she stresses that the data are not yet published.

"Dogs show some aversion to inequity," she says. "I prefer not to call it a sense of fairness, but others might."