The third major castle, Viipuri (or Viborg in Swedish), was built as the easternmost outpost of the kingdom of Sweden. It was taken by the Russians in 1710, but was back in Finnish hands in 1812. Since the end of the war in 1944 it has again been on the Russian side of the border. During the Middle Ages it was repeatedly besieged by the Russians, most famously in 1495, under Ivan III of Moscow. The situation of the defenders looked hopeless, but they were saved by the 'Viborg blast', a mysterious explosion which scared off the Russians because they saw a St. Andrew's cross in the sky.
The three Finnish 'castle counties' were ruled from the castles of Turku, Häme and Viborg, respectively until the 1360s. In 1366, Albrecht of Mecklenburg was elected king, and according to the German model he began to divide up the castle counties into smaller provinces. In some cases, these new, smaller provinces were given separate bailiffs' residences which have since disappeared; this was the case with the Borgbacken castle mound in Porvoo and Korsholm in Ostrobothnia, near the city of Vaasa which was founded later. Only earthworks remain at these sites, but in two places, stone strongholds were built which still exist, although in ruins. One is Raseborg in western Uusimaa (west of Helsinki), the other Kastelholm in the Åland islands.