Having become a fief of the Fieschi family in the XIII century, Santa Margherita passed into the hands of Genoa. This was how matters remained until the end of the eighteenth century.
On 18 July, 1798 the village was still divided into two autonomous hamlets: Corte was situated in front of the port area, with Pescino by the sea next to the parish church on the Ghiaia beach – the two hamlets separated by a hill.
On that day, however, the “Municipalists” took control of Pescino, now presiding over the canton of Santa Margherita and the canton of San Giacomo – two cantons that were often in fierce rivalry with each other.
On 22 December, 1812 Napoleon, through an imperial decree, united Santa Margherita and San Giacomo in a single municipality bearing his august name, Port Napoleon. After the fall of the empire, a governor was appointed in Genoa and the individual municipalities passed into provisional administration. In 1818, according to the wishes of the governor, the city of Santa Margherita di Rapallo was founded, and was run by a Council of Elders, headed by Gerolamo Costaguta.
Forty-five years later, in 1863, Vittorio Emanuele definitively named it Santa Margherita Ligure.