In 840, with the Franks trying to take the city, the people elected Sergius as duke (or magister militum) of Naples.
This was a move towards complete independence from the Byzantine Empire, which was incapable of defending the Ducatus Neapolitanus from the Lombards.
The Saracens soon became too dangerous to keep as friends and Naples was forced to ally with Amalfi, Gaeta, and Sorrento, its practically independent underlings, and make war on the Muslims.
In 847, Sergius was charged, along with Guy I of Spoleto, with establishing peace between the Lombard princes Siconulf of Salerno and Radelchis I of Benevento.
In 850, Sergius attempted (successfully) to make the duchy hereditary when he appointed his eldest son, Gregory, as co-duke.