
In the 16th century Kainuu was a troubled border region which had aroused the colonialist ambitions of both Sweden and Russia. Kajaani Castle (Kajaneborg in Swedish) was built at the beginning of the 17th century as an administrational centre which would secure the north-eastern part of the Swedish empire. The remote wilderness castle also served as a prison and place of exile for political prisoners, the most famous of which was the historian Johannes Messenius.
The Barony of Kajaani was granted in 1650 to Count Per Brahe who served as Governor General of Finland during the periods 1637 - 1640 and 1648 - 1654. He developed governmental structures and public highways throughout the land as well as founded the University of Turku and several towns and cities.
During his third journey to Kainuu in 1651 Per Brahe founded the town of Kajaani. The small town consisted of nothing more than humble log dwellings and was surrounded by a border barrier.
An illustration of the town of Kajaani from 1659. The illustration shows the surrounding barrier and toll gates. The castle seems to have had a wooden tower.

Count Per Brahe