Karelian fort which was burned. The castle, which was the first centre for the spread of Christianity in Karelia, was fought over for decades between Sweden and the Republic of Novgorod. As a result of the Treaty of Nöteborg in 1323 between the Novgorod Republic and Sweden, Vyborg was finally recognized as a part of Sweden. The town's trade privileges were chartered by the Pan-Scandinavian King Eric of Pomerania in 1403. It withstood a prolonged siege by Daniil Shchenya during the Russo-Swedish War of 1496–1497. Under Swedish rule, Vyborg was closely associated with the noble family of Bååt, originally from Småland. The late-medieval commanders and fief holders of Vyborg were (almost always) descended from or married to the Bååt family. In practice, though not having this as their formal title, they functioned as Margraves, had feudal privileges, and kept all the crown's incomes from the fief to use for the defense of the realm's eastern border. 1710 to 1917 Vyborg remained in Swedish hands until its capture in 1710 after the Siege of Vyborg by Tsar Peter the Great in the Great Northern War. In the course of Peter's second administrative reform, Vyborg became the seat of the Vyborg Province of St. Petersburg Governorate. The 1721 Treaty of Nystad, which concluded the war with Sweden, finalized the transfer of the town and a part of Old Finland to Russia. The loss of Vyborg led Sweden to develop Fredrikshamn as a substitute port town. Another result of the loss of Vyborg was that its diocese was moved to Borgå, transforming the town into an important learning centre. In 1744, Vyborg became the seat of the Vyborg Governorate. In 1783, the governorate was transformed into the Vyborg Viceroyalty and in 1801 back into Vyborg Governorate. In 1802, the Vyborg Governorate was renamed the Finland Governorate. One of the largest naval battles in history, the Battle of Vyborg Bay, was fought off the shore of the Vyborg Bay on July 4, 1790. After the rest of Finland was ceded to Russia in 1809, Emperor Alexander I incorporated the town and the governorate into the newly-created Grand Duchy of Finland in 1811 (1812 NS). Over the course of the 19th century, the town developed as the centre of administration and trade for eastern Finland. The inauguration of the Saimaa Canal in 1856 benefited the local economy, as it opened the vast waterways of Eastern