The city was founded in 1639, based on Olavinlinna castle ("St. Olaf's Castle"). The castle was founded by Erik Axelsson Tott in 1475 in an effort to protect Savonia and to control the unstable border between the Kingdom of Sweden and its Russian adversary. During the Russo-Swedish War (1741–1743), the castle was captured by Field-Marshal Peter Lacy. It was held by Russia between 1743 and 1812, when it was granted back to Finland as a part of "Old Finland".