The country derives its name from Saint Marinus, a stonemason from the then-Roman island of Rab in present-day Croatia. Born in AD 275, Marinus participated in the rebuilding of city walls of Rimini on Italy's Adriatic coast after their destruction by Liburnian pirates. Marinus then went on to found an independently ruled monastic community on Mount Titan, about ten miles inland from Rimini, in AD 301; thus, San Marino lays claim to being the oldest extant sovereign state, as well as the oldest constitutional republic.
Uniquely, San Marino's constitution dictates that its democratically elected legislature, the Grand and General Council, must elect two heads of state every six months. Known as Captains Regent, the two heads of state serve concurrently and hold equal powers until their term expires after six months.
So if San Marino has been independent since 301 and self-governing, what's all thus about it being only 1,300 years old. Therein lies the dabate about what constitutes a "national republic" that is, a nation that is independent, and a territory that is merely a self-governing polity within a nation. From 301 to 1291, San Marino was self-governing in the sense that was a monastic community possessed of land. While it was recognized as not being subject to the laws of government of the Roman Empire or any of the subsequent states that rose and fell on the Italian peninsula after Empire fell in the West, it was not a truly independent state and could rightly be regarded as the first "papal state" as the territory within Italy controlled by the Roman Catholic Church would subsequently come to be known in the 8th Century. In 1291, however, the San Marino had from a single monastic community to include a number of nearby town whose populations were mostly free citizens who owned allegiance to no prince or other noble. While there was no formal separation from the governance by the Church, 1291 is generally recognized as the date of San Marino's de facto independence from the Church's overlordship.
Nonetheless, while never formally submitting to the Vatican's authority, the state continued to look to the Papal States for protection and was even at times an objective of interest to competing papal claimants. In 1503, Cesare Borgia, the son of Pope Alexander VI occupied the Republic for six months until his father's successor, Pope Julius II, intervened and restored the country's independence. On 4 June 1543 Fabiano di Monte San Savino, nephew of the later Pope Julius III, attempted to conquer the republic, but his infantry and cavalry failed as they got lost in a dense fog, which the Sammarinese attributed to Saint Quirinus, whose feast day it was.
Although governed by some form of elected counsel, first of monks and later of citizens, the Serene Republic's existence was not formally declared in law until October 8, 1600. It was on this date that San Marino adopted it constitution, officially called the Statuta Decreta ac Ordinamenta Illustric Reipublicae ac Perpetuae libertatis Terram Sancti Marin, or Statutes, Decrees, and Ordinances of the Serene Republic and the Perpetual Freedom of the Land of San Marino. Curiously, while there may some doubt as to the claim to have been an independent republic from 301, this document is universally recognized as the earliest written constitution still in effect.
The country was occupied on 17 October 1739 by the legate (Papal governor) of Ravenna, Cardinal Giulio Alberoni, but independence was restored by Pope Clement XII on 5 February 1740, the feast day of Saint Agatha, after which she became a patron saint of the republic.
The advance of Napoleon's army in 1797 presented a brief threat to the independence of San Marino, but the country was saved from losing its liberty by one of its regents, Antonio Onofri, who managed to gain the respect and friendship of Napoleon. Due to Onofri's intervention, Napoleon, in a letter delivered to Gaspard Monge, scientist and commissary of the French Government for Science and Art, promised to guarantee and protect the independence of the Republic, even offering to extend its territory according to its needs. The offer was declined by the regents, fearing future retaliation from other states' revanchism.
During the later phase of the Italian unification process in the 19th century, San Marino served as a refuge for many people persecuted because of their support for unification, including Giuseppe Garibaldi and his wife Anita.
The government of San Marino made United States President Abraham Lincoln an honorary citizen. He wrote in reply, saying that the republic proved that "government founded on republican principles is capable of being so administered as to be secure and enduring."
San Marino remained officially neutral in both the First and Second World Wars. In September 1944, it was briefly occupied by German forces, who were defeated by Allied forces in the Battle of San Marino.
San Marino had the world's first democratically elected communist government – a coalition between the Sammarinese Communist Party and the Sammarinese Socialist Party, which held office between 1945 and 1957.
At the 2020 Summer Olympics, San Marino became the smallest country to earn a medal, as Alessandra Perilli won bronze in the women’s trap shooting event.
San Marino has the political framework of a parliamentary representative democratic republic: the captains regent are both heads of state and heads of government, and there is a pluriform multi-party system. Executive power is exercised by the government. Legislative power is vested in both the government and the Grand and General Council. The judiciary is independent of the executive and the legislature.
Every six months, the council elects two captains regents to be the heads of state. The regents are chosen from opposing parties so that there is a balance of power. They serve a six-month term. The investiture of the captains regent takes place on 1 April and 1 October in every year. Once this term is over, citizens have three days in which to file complaints about the captains' activities. If they warrant it, judicial proceedings against the ex-head(s) of state can be initiated.
The practice of having two heads of state, like Roman consuls, chosen in frequent elections, is derived directly from the customs of the Roman Republic. The council is equivalent to the Roman Senate; the captains regent, to the consuls of ancient Rome. It is thought the inhabitants of the area came together as Roman rule collapsed to form a rudimentary government for their own protection from foreign rule. San Marino has had more female heads of state than any other country: 15 as of October 2014, including three who served twice.
So, given its age and the unquestioned position as being governed by the oldest written constitution still in effect, what this about it being a relatively new state? This refers to the fact that until July 12, 1974, San Marino had not made provision for the rights of its citizens -- if effect, the Sammarinese had no guarantee of civil liberty. It was on July 12, 1978 that the Serene Republic finally formally recognized the its Declaration of Citizen Rights the individual liberties that are indispensable to a democratic republic. Containing a declaration of citizen rights and the fundamental principles of the juridical order of San Marino, the Declaration begins with a repudiation of war. It states the people are sovereign and explains how the separation of powers doctrine is applicable to San Marino. Citizens are guaranteed certain rights including equality, inviolability, freedom, and universal suffrage. The Declaration was amended in 2002, providing further constitutional detail on the organization of government and establishing the Guarantors’ Panel on the Constitutionality of Rules, which is a court responsible for assessing the compliance of laws with respect to the Declaration of Rights.