The present paper extends the Folk theorem in repeated games to the situation where agents change their partners over time. Cooperation is sustained because defection against one agent causes sanction by others, and the paper shows how such a "social norm" is sustained by self-interested agents. Two main results are presented. The first is an example where a community can sustain cooperation when each agent knows nothing more than his personal experience. The second shows that the community can realize any mutually beneficial outcomes when each agent carries a label such as reputation, membership, or license, which are revised systematically. Copyright 1992 by The Review of Economic Studies Limited.