The first historical mentions of Sansepolcro date to 1012, referring to the construction of the monastery, around which a commune began to develop due to its being declared a market town by the Emperor Conrad II, Holy Roman Emperor. The abbey chose to affiliate itself with the monks of the Camaldolese Order, based in the area, in the following century. During the conflicts between the Guelfs and Ghibellines, the town's factions were headed by prominent local families, including the Pichi, Bercordati, Graziani and Bacci.