The Kajaani castle was built on the Ämmäkoski island of the Kajaani river in the centre of Kajaani, Finland, in the 17th century. It functioned as a governing centre, a prison, and a refuge for residents during times of persecution. The most famous prisoner in the castle was the historian Johannes Messenius, who was forced to live in the poor conditions of the castle from 1616 to 1635.
Construction of the Kajaani castle began in 1604 and was completed in 1619. At first the castle only consisted of a stone wall, two round towers, and wooden buildings in the yard inside the castle. The second phase of construction was ordered by Count Peter Brahe which began in the 1650s and was completed in 1666. Upon completion many of the original wooden structures had been replaced with stone and the castle had become a fortress.
During the “Greater Wrath”, Russian forces kept the castle under siege for months, and upon its surrender they blew up much of the fortress, transporting the inhabitants to Russia to be imprisoned. Kajaani Castle is thought to be the smallest stone castle, and the most northernmost, in the world.
https://www.discoveringfinland.com/destination/kajaani-castle/