It can be said that San Sebastian as such was founded in 1180 by King Sancho el Sabio, who was the King of Navarra. The main reason behind this establishment was so it could be used as a sea port for Navarra. However, in 1200 San Sebastian became a vassal town to the Castilian King Alfonso VIII and therefore it turned into Castilian's sea port.
King Alfonso VIII confirmed the special regional laws awarded by the previous King of Navarra and granted San Sebastian a number of privileges. These privileges helped to keep alive the commerce with Navarra and gave a better situation for San Sebastian's traders who also exchanged goods in the Spanish market.
From 1266 San Sebastian went up in flames on several occasions and it completely burnt down six times. It was in January 1489, after a fire which reduced the town to ashes, that it was decided to rebuild it using stone instead of timber.
Towards the end of the 15th Century and thanks to its strategic location and the importance of its port, San Sebastian changed from being an important commercial town to become the naval base of the Fleet of Cantabria. This marine force fought for centuries against the French, the Dutch and the British fleets.
Felipe IV awarded San Sebastian a City status in 1662.
During the Independence War, San Sebastian was occupied by Napoleonic Forces in 1808. But in June 1813, the allied English-Portuguese troops besieged the city and left it isolated until the French troops surrendered on September 8th.
In 1854 San Sebastian is nominated as Guipuzcoa's capital.
After an intense debate, in 1863 it is decided to knock down the city walls as they were stopping its development as a municipality. Once finished its era as a fortress, San Sebastian changes direction and begins to expand. It is then that the city starts to fulfill the role of capital of the province.
Queen Maria Cristina was a key figure in consolidating San Sebastian as a tourist resort for the Spanish middle class. She had fallen in love with the city and spent her summer holidays at the Palacio de Miramar (Miramar Palace) between 1893 and 1928, the year before she died. As appreciation, one of the bridges, the Reina Regente street and the main hotel in the city, besides several sculptures, were dedicated to her.
At the begining of the First World War, in 1914, San Sebastian became the most cosmopolitan city in Europe. All the best known and affluent people in Europe would meet at the Casino. It was the Belle Époque.
Shortly after the Spanish Civil War broke out, on September 13th 1936, San Sebastian fell to the rebels. The dictatorship kept San Sebastian as a summer residence. Franco came every year to the Palacio de Ayete during the month of August, between 1940 and 1975.