The castle of San Leolino was probably built on a pre-existing fortification, perhaps Roman, and was property of the Counts Guidi fromBattifolle and Poppi until at least the 11th century. The first historical information comes to us thanks to a donation act made by the Guidi themselves to the Camaldoli Monastery in 1100. The castle, now ruined, represented for the Guidi counts the most advanced point of greatest military strength stretched out in the Florentine countryside from his native Casentino. San Leolino was for a long time the most important stronghold in the area, highly fortified and seat of the military garrison.
The castle did not have an exclusively military function, but held a court and residential use. In 1239, an important historical figure resided there: Guido Guerra V of Modigliana. Born in 1220, his father was orphaned at an early age, he was entrusted to his paternal uncles and at the age of 14 he was a squire and protégé of Emperor Frederick II of Swabia.
Although he grew up in the Swabian court, the capital of European Ghibellism, Guido Guerra V returned to Florence and married the Guelph cause, fighting for the Florentines in numerous battles. The victories, fidelity and skills of the Guidi made him one of the main Guelph captains, becoming over time the trusted man of Pope Innocentius IV.
Such had become his detachment from the Emperor who in 1245 was part of the escort who accompanied the Pope to the council of Lyons in which Innocent IV solemnly excommunicated the Emperor Frederick II. In 1248 he obtained from the Pope the title of Capitanei pro ecclesia, Captain General of the Holy See. Loyalty to Florence culminated with the victory of the battle of Benevento on February 26, 1266, in which the Guelph troops of Charles of Anjou defeated the Ghibellines of Manfredi of Sicily. Guidi returned to Florence as a triumph and was entrusted with the captaincy of the city, the first case of assignment of this office to a non-Florentine. The memory of Guido Guerra was impressed over time by Dante Alighieri who in the Divine Comedy places him among the three Florentine sodomites in the XVI canto of Hell “nephew was of good Gualdrada; Guido Guerra had his name, and in his life he did a lot with his wisdom and with the sword ”.
During the decline of the Conti Guidi Dynasty, the Castle of San Leolino was one of the last castles to fall into Florentine hands. Proof of the importance of the fortification is evidenced by the fact that at the time of the final subjugation of the Guidi (in the mid-fifteenth century), the fortress remained the seat of an armed Florentine garrison, led by a castellan militarily attentive to that corner of the countryside. The Grand Duke of Tuscany Ferdinando II in 1645 re-established the feudal territory with the title of Marquisate of San Lorino.