Due to its central location on the local trade routes, in the 13th century control of the town was contested and seized by various forces of the region, passing from Uguccione della Faggiola, Lord of Pisa, to Guido Tarlati, Bishop of Arezzo, and his brother, Pier Saccone Tarlati di Pietramala, who ruled it from Città di Castello, and then to the rule of the Papal States. The local dialect in fact derives from the Citta' di Castello one and the Casentino valley one that arrived later. In 1367 Pope Urban V gave the town and its surrounding "contrada" to the Malatesta family, whose heirs ruled it until control was assumed by the Republic of Florence in the 15th century with the approval of Pope Eugene IV. It was raised to the rank of a city a century later by Pope Leo X.