This paper presents a formal theory of reciprocity. Reciprocity means that people reward kind actions and punish unkind ones. The theory takes into account that people evaluate the kindness of an action not only by its consequences but also by the intention underlying this action. The theory explains the relevant stylized facts of a wide range of experimental games. Among them are the ultimatum game, the gift-exchange game, a reduced best-shot game, the dictator game, the prisoner's dilemma, and public goods games. Furthermore, the theory explains why the same consequences trigger different reciprocal responses in different environments Finally the theory explains why in bilaterial interactions outcomes tend to be fair' whereas in competitive markets even extremely unfair distributions may arise.