According to tradition, it was founded in 301 AD when a Christian stonemason named Marinus the Dalmatian fled the island of Arbe to escape the anti-Christian Roman Emperor Diocletian. Marinus hid on the peak of Mount Titano and founded a small community of people following their Christian beliefs.
It's certain that the area had been inhabited since prehistoric times, although evidence of existence on Mount Titano dates back only to the Middle Ages.
In memory of the above mentioned stone cutter, the land was renamed "Land of San Marino," then called the "Community of San Marino," and was finally changed to its present-day name, "Republic of San Marino."
San Marino's constitution was enacted in 1600, and to this day remains the world's oldest constitution still in use.
During the late 19th century Italy went through a phase of unification, wherein San Marino became a place of refuge for many displaced Italians persecuted for their support of the cause. In their defense and in keeping with the wishes of his country, Giuseppe Garibaldi chose not to be incorporated into the new Italian state during the unification process.
During both World Wars I and II, San Marino remained neutral, however, despite this declaration the country was wrongly accused of declaring war against the United Kingdom in 1940. Then, in the summer of 1944, San Marino was bombed by the Royal Air Force after mistakenly believed to have been overtaken by German forces.
In 1988 San Marino joined the Council of Europe, followed by the United Nations in 1992.
Post war, 1945 through 1957, San Marino became the first European country to elect a communistic government through a democratic election, and for a second time between 2006 and 2008.
As one of the wealthiest countries in the world (based on GDP per capita) San Marino's economy relies heavily on finance, industry and tourism, and as a whole experiences low unemployment rates, no national debt and a budget surplus to top it all off.