San Marino, the oldest republic in the world, is the sole survivor of the independent states that existed in Italy at various times from the downfall of the Western Roman Empire to the proclamation of the Kingdom of Italy in 1861. (The Vatican City State, which is also an independent enclave in Italy, was not constituted in its present form until the 20th century.)
According to tradition, the republic was founded in AD 301 by Marinus, a Christian stonecutter who fled from Dalmatia to avoid religious persecution; later canonized, St. Marinus is known in Italian as San Marino. If founded at the time asserted by tradition, San Marino is the oldest existing national state in Europe. There was a monastery in San Marino in existence at least as early as 885.
Because of the poverty of the region and the difficult terrain, San Marino was rarely disturbed by outside powers, and it generally avoided the factional fights of the Middle Ages. For a time, it joined the Ghibellines and was therefore interdicted by Pope Innocent IV in 1247–49. It was protected by the Montefeltro family, later dukes of Urbino, and in 1441, with Urbino, it defeated Sigismondo Malatesta and extended the size of its territory. It was briefly held by Cesare Borgia in 1503, but in 1549 its sovereignty was confirmed by Pope Paul III. In 1739, however, a military force under a papal legate, Cardinal Giulio Alberoni, occupied San Marino and unsuccessfully attempted to get the Sanmarinese to acknowledge his sovereignty over them. In the following year, Pope Clement II terminated the occupation and signed a treaty of friendship with the tiny republic. Napoleon allowed San Marino to retain its liberty; the Sanmarinese are said to have declined his offer to increase their territory on the grounds that smallness and poverty alone had kept them from falling prey to larger states.
In 1849, Giuseppe Garibaldi, the liberator of Italy, took refuge from the Austrians in San Marino; he departed voluntarily shortly before the Austrians were to invade the republic to capture him. San Marino and Italy entered into a treaty of friendship and customs union in 1862. This treaty was renewed in March 1939 and amended in September 1971.
During the period of Mussolini's rule in Italy, San Marino adopted a Fascist type of government. Despite its claim to neutrality in World War II, Allied planes bombed it on 26 June 1944. The raid caused heavy damage, especially to the railway line, and killed a number of persons. San Marino's resources were sorely taxed to provide food and shelter for the over 100,000 refugees who obtained sanctuary during the war.
The elections of 1945 put a coalition of Communists and left-wing Socialists in control of the country. In 1957, some defections from the ruling coalition were followed by a bloodless revolution, aided by Italy, against the government. The leftists surrendered, and some were imprisoned. The rightists, chiefly Christian Democrats, won the election of 1959 and remained in power until 1973, chiefly in coalition with the Social Democrats. In March 1973, after splitting with the Social Democrats, the Christian Democrats formed an unstable coalition with the Socialists. After new elections in May 1978, the Communists, the Socialists, and the Socialist Unity Party, who together commanded a one-seat majority in the legislature, formed a governing coalition; San Marino thus became the only West European country with a Communist-led government. This coalition governed until 1986, when a Communist–Christian Democratic coalition, replaced it; this was the first coalition government formed by these two parties in San Marino's history.
As of 2003, the ruling coalition was composed of the Sanmarinese Christian-Democratic Party and the Sanmarinese Socialist Party. In December 2002, Fiorenzo Stolfi was named secretary of state for foreign and political affairs, the equivalent of the office of a prime minister.
San Marino's high standard of living makes Sanmarinese citizenship a valuable commodity. With the only ways for foreigners to obtain citizenship being to reside in San Marino for 30 years or marry a male citizen, the government passed a law in August 1999 prohibiting female household servants under 50 because of the potential for elderly men to fall for their young female help who may have suspicious motives.
Also in 1999, San Marino joined the European Monetary Union and adopted the euro as its currency. The Europe-wide single currency was forecasted to boost tourism but simultaneously hurt Sanmarinese bank revenues as the banks would no longer be able charge fees for currency exchange. In June 2000, the OECD accused Sanmarinese banks of making the country a "harmful" tax haven; San Marino promised to reform its banking practices.
Because San Marino has a customs union with Italy, it enjoys all of the benefits that flow from European Union membership. However, San Marino's goal ultimately is to become a full-fledged member of the EU.