Chimpanzees display a similar sense of fairness to humans, one which is shaped by social relationships, experts claim.
A sense of fairness may have deep evolutionary roots
They found that, like humans, chimps react to unfairness in various ways depending on their social situation.
Details of the study appear in the journal Proceedings of the Royal Society B: Biological Sciences.
A similar finding has been reported in capuchin monkeys, suggesting that a sense of fairness may have a long evolutionary history in primates.
In the study by researchers at the Yerkes National Primate Research Center in Atlanta, US, chimps were paired to see how they would respond if one received a better reward than the other for doing the same amount of work.
When the pair came from a group that had known each other only a short time, the unfairly treated chimp responded negatively.
An animal rewarded with cucumbers - instead of highly prized grapes - "downed tools" and refused to do any more work.
But when the pair were from a close-knit social group that had bonded over a long period of time, unfairness was more likely to be tolerated.
Fair play award
The same reaction is seen in humans, who tend to react negatively to unfair situations with strangers, but not when they involve family members or friends.
"Human decisions tend to be emotional and vary depending on the other people involved," said Dr Sarah Brosnan, of Yerkes.
"Our finding in chimpanzees implies this variability in response is adaptive and emphasises there is not one best response for any given situation but rather it depends on the social environment at the time."
The chimps were given different rewards for doing the same work
In a previous study, the same team identified a sense of fairness in capuchin monkeys.
"Identifying a sense of fairness in two, closely related non-human primate species implies it could have a long evolutionary history," Dr Brosnan explained.
"The capuchin responses as well as those of the chimpanzees - the most closely related species to humans - could represent stages in the evolution of the complex responses to inequity exhibited by humans and may help explain why we make certain decisions."
The scientists found chimps demonstrated "inequity aversion" when they were treated unfairly, but not when they received the better reward.
They seemed willing to take advantage of good luck while their partner lost out. The same response was seen in capuchins.
But even this selfish response mirrored human behaviour, said the researchers.
"Whereas people may prefer equity to any sort of inequity, advantageous inequity is typically preferred to disadvantageous inequity," the researchers write in Proceedings B.
"Most people tend to respond by psychological rather than material compensation - that is, justifying why they deserved a superior reward - and most people will choose to ignore information that could lead to a more fair outcome at a cost to the self."