This paper argues that morality is a product of basic human psychological characteristics shaped over prehistorical and historical time by diachronic dialectical transactions between what individuals do and what they are supposed to do in the culture in which they live. Some principles are pancultural: individuals are motivated to look after their own interests, to be cooperative and kind to other group members and to look after their children. The moral precepts of every society are based on these principles, but may differ according to the vicissitudes that the society has experienced. Thus the basic principles can be seen as absolute; the precepts based on them may be specific to particular societies. Moral precepts, and the laws derived from them, are mostly such as to maintain the cohesion of the society, but some have been formulated to further the interests of those in power. The evidence suggests that laws have been developed, by common consent or by rulers, from generally accepted moral intuitions. In general, legal systems have been formulated to deal with the more extreme infringements of moral codes. Morality prescribes how people should behave; the law is concerned with how they should not. New laws, if not imposed by force, must generally be in tune with public conceptions of morality.