The city is claimed to be founded bySaint Marinus and several Christian refugees fleeing fromRoman persecution in the year 301.
The urban heart of the city was protected bythree towers: the first,Guaita, built in the 11th century, held a reputation for being impenetrable which to a great extent discouraged attacks.
Tensions with bordering powers urged the necessity to build a second tower,Cesta (13th century). The defensive system was not completed until the construction of a third tower, theMontale (14th century)—the smallest of all and constructed on the last of the summits of Monte Titano.
With the population of the city increasing, the territory of the country was extended by a few square kilometers. Since the Sammarinese policy was not to invade or to use war to obtain new territories, it was by means of purchases and treaties that San Marino obtained the other eightcastelli which make up the country.
Since 2008, the city has been enlisted as aUNESCO World Heritage Site under the inscription "San Marino Historic Centre and Mount Titano."
The city serves as the headquarters of theSammarinese Christian Democratic Party, a conservative party that currently serves as one of the main governing parties.
The economy of the city of San Marino has always been closely bound tothat of the country. Until recently, the main economic activities of the locality were stone extraction and carving. Today, there is a more varied economy, including tourism, commerce, sale of postage stamps, and a small agricultural industry, although the latter is in decline.
The city is visited by more than three million people per year, and has developed progressively as a tourist centre. Of the tourists, 85% are Italian. There are also more than a thousand retail outlets.
The city is known for its long, winding cobblestoned streets, as its altitude and steep approach put it beyond the reach of theSan Marino Highway. San Marino is also notable in that cars are prohibited in much of the city center. A series oflifts connects the upper part of city with the lower.
The City of San Marino is the terminus of seven of San Marino's eight bus lines, which run to other settlements in the country.[8] Additionally, the central bus stop in Piazzale Marino Calcigni is the terminus of a regular coach connection toRimini,[9][7] operated by coach companies Bonelli and Benedettini.[9]
Between 1932 and 1944, a 31.5-kilometre (19.6-mile)electrifiednarrow gauge railway operated between Rimini and the City of San Marino.[10] During theSecond World War, the line was bombed and closed,[10][11] after which its tunnels sheltered refugees during the Battles ofRimini andSan Marino.[12][13] After the war, the railway was abandoned in favour of the San Marino Highway.[13][14]
In 2012, an 800-metre (1⁄2-mile) section was reopened as aheritage railway in the City of San Marino, running between Piazzale della Stazione and near Via Napoleone.[15] The restored section comprises the original railway's final horseshoe turn through the 502-metre (1,647-foot) Montale tunnel.[16][17]
^Giuliani-Balestrino, Maria Clotilde (2005)."La superstrada Rimini-San Marino" [The Rimini-San Marino railway](PDF).Studi e Ricerche di Geografia (in Italian).29 (1):1–4.
^Scolari, Giancarlo (21 June 2012)."Torna il treno a San Marino" [The train returns to San Marino].Ferrovie.it (in Italian). Retrieved3 November 2023.
^Vilmos, Oszter (12 August 2012)."Kis ország, kis( )vasút" [Small country, small railway].Indóház Online (in Hungarian). Retrieved5 November 2023.