The original government structure was composed of a self-governed assembly known as the Arengo, which consisted of the heads of each family. In 1243, the positions of Captains Regent (Capitani Reggenti) were established to be the joint heads of state. The state's earliest statutes date back to 1263.
The land area of San Marino consisted only of Mount Titano until 1463, at which time the republic entered into an alliance against Sigismondo Pandolfo Malatesta, Lord of Rimini, who was later defeated. As a result, Pope Pius II gave San Marino the towns of Fiorentino, Montegiardino, and Serravalle. Later that year, the town of Faetano joined the republic on its own accord. Since then, the size of San Marino has remained unchanged.
San Marino adopted its written constitution on October 8, 1600.
San Marino has been occupied by foreign militaries twice in its history, both for only short periods of time. In 1503, Cesare Borgia, known as Valentino, occupied the republic until his death several months later. In 1739, Cardinal Alberoni used military force to occupy the country, but civil disobedience was used to protest this, and clandestine notes sent to the Pope to obtain justice were answered by the Pope's recognition of San Marino's rights and restored them to independence.
The state was recognized by Napoleon in 1797 and by the Congress of Vienna in 1815. San Marino maintains diplomatic and consular relations with a number of European and American countries, mints its own coins, issues its own postage stamps and grants honours of merit. Legislative power is exercised by the Grand Council of 60 members and the executive by a State Congress divided into ministries, renewed with each legislature. The Capitani Reggenti have a representative mandate and are elected twice yearly, in April and October.
San Marino is the only surviving Italian city-state. Like Andorra, Liechtenstein and Monaco, it appears an anachronism, a reminder of the times when Europe – particularly Germany, Italy and the Pyrenees – was made up of tiny political units, often extending no further than a cannon could fire from a city’s walls. Of all the small European countries, San Marino’s survival is the most surprising. Apart from the Vatican City (whose development followed a different course), it is the only one which is completely surrounded by one other country. Various treaties of friendship have been signed with Italy since the latter’s unification, but San Marino proudly asserts its independence where possible.
Having joined the Council of Europe as a full member in 1988, San Marino held the chair of the organisation during the first half of 1990.
San Marino became a member of the United Nations in 1992.