In the following centuries the authority of the distant Empire of Byzantium faded; initially part of the substantially independent Duchy of Naples, later Sorrento became in turn an autonomous duchy in the 9th century. It fought against neighbouring/rival Amalfi, the Saracens and the nearby Lombardic duchies, such as that of Duchy of Benevento, whose forces besieged it in 839, although Sorrento was able to resist with Neapolitan help. Sorrentine forces took part in the anti-Saracen leagues at the battles of Licosa (846) and Ostia (849). The duchy was ruled by figures elected by the people, which received honorary titles from the Byzantine Emperor.