The events that saw the presence of the Swabian emperors in Tuscany at the end of the 12th century linked particularly to the city of Pisa involved many of the castles of this area of the Lower Valdarno, including Barbialla, Collegalli, Tonda, and probably the castle of Pietra. The imperial diplomas issued in 1162, 1191, and 1206 confirm, on different occasions, the ceding in fief of those castles to the Republic of Pisa, removing them from the control of the bishop of Volterra and from San Miniato, a village then in strong ascent. The broad privilege granted to the Pisan allies legitimized the city’s aspirations to a vast territorial area over which, up until that time, it had had no real dominion. This was, however, an unsuccessful attempt: by the middle of the 13th century, San Miniato once again obtained the castles of the Val d'Egola, now part of the districtus that the powerful imperial castle was consolidating in those years. In fact, two acts, of 1242 and 1257, show that the trade in cereals produced in the curtis of the castle of Barbialla had to follow the impositions of the municipality of San Miniato. The history of this small castle, thus, follows that of San Miniato, which at the end of the 13th century had extended its dominion over a vast area included between the dioceses of Lucca and Volterra, centered on a network of pre-existing castles, whose structure it did not change, but which it used to control its territory. The districtus of San Miniato included a broad sector located between the Val d'Egola and the Valdelsa, whose framework was based on that of the dioceses to which the existing castles belonged. The organization of the territory was entrusted locally by the bodies managing the castle communities linked to San Miniato by pacts of submission. However, during the 14th century, the political structure of this territory changed radically. In 1369, Florence, whose sights on the territory of San Miniato and the rights of transit through the Pisan and Volterran routes and the Arno had already been evident for some time, established a regime of occupation in the San Miniato fortress, which was followed by acts of submission from all the castles of its districtus. Barbialla and the other castles of the territory of San Miniato become part of the Florentine countryside. The redefinition of the local government structures saw the establishment of a podesteria with a center at Barbialla, upon which the communities of Collegalli, Santo Stefano, and Coiano depended.