The rapid growth of cities from the eleventh to the thirteenth century raises the question of how a sense of community was created among inhabitants who were migrants from disparate backgrounds. Before urban institutions and legislation emerged, informal social structures based on trust networks appear to have fostered socialization and an adaptation to new ways of life. Travelling merchants created various kinds of associations which were at the origins of the sworn communes. The merchants' guilds also strove to protect citizens on their travels. The growth of the cities led to the need to institutionalize these functions.