Italy used to be a patchwork of various city-states and kingdoms until around 1860 or so, when Giuseppe Garibaldi and his armies succeeded in unifying all of these various entities into the modern nation of Italy. San Remo, being in the northwest, was always under the influence of the nearby powerful nation-state of Genoa. The French also had some sway there at varying points.
It's possible that your great-grandfather may have been born at a time when there was no Italy to speak of, but rather Florence, Pisa, Genoa, Venice, Papal States, Kingdom of the Two Sicilies, etc.