Though human morality may end in notions of rights and justice and fine ethical distinctions, it begins, Dr. de Waal says, in concern for others and the understanding of social rules as to how they should be treated. At this lower level, primatologists have shown, there is what they consider to be a sizable overlap between the behavior of people and other social primates.

Social living requires empathy, which is especially evident in chimpanzees, as well as ways of bringing internal hostilities to an end. Every species of ape and monkey has its own protocol for reconciliation after fights, Dr. de Waal has found. If two males fail to make up, female chimpanzees will often bring the rivals together, as if sensing that discord makes their community worse off and more vulnerable to attack by neighbors. Or they will head off a fight by taking stones out of the males’ hands.

Dr. de Waal believes that these actions are undertaken for the greater good of the community, as distinct from person-to-person relationships, and are a significant precursor of morality in human societies.

Macaques and chimpanzees have a sense of social order and rules of expected behavior, mostly to do with the hierarchical natures of their societies, in which each member knows its own place. Young rhesus monkeys learn quickly how to behave, and occasionally get a finger or toe bitten off as punishment. Other primates also have a sense of reciprocity and fairness. They remember who did them favors and who did them wrong. Chimps are more likely to share food with those who have groomed them. Capuchin monkeys show their displeasure if given a smaller reward than a partner receives for performing the same task, like a piece of cucumber instead of a grape.

These four kinds of behavior — empathy, the ability to learn and follow social rules, reciprocity and peacemaking — are the basis of sociality.

Dr. de Waal sees human morality as having grown out of primate sociality, but with two extra levels of sophistication. People enforce their society’s moral codes much more rigorously with rewards, punishments and reputation building. They also apply a degree of judgment and reason, for which there are no parallels in animals.

Religion can be seen as another special ingredient of human societies, though one that emerged thousands of years after morality, in Dr. de Waal’s view. There are clear precursors of morality in nonhuman primates, but no precursors of religion. So it seems reasonable to assume that as humans evolved away from chimps, morality emerged first, followed by religion. “I look at religions as recent additions,” he said. “Their function may have to do with social life, and enforcement of rules and giving a narrative to them, which is what religions really do.”