It is not known exactly when the Tiefburg castle was built or by whom. It is assumed that it was built in the 12th century, possibly by the Abbey of Lorsch or the Count Palatinates of the Rhine (later known as the Prince Electors of the Palatinate), who set up residence in nearby Heidelberg around this time. It is also possible that the castle had its origins in a fortiied estate. The knights of Handschuhsheim who lived in the Tiefburg were initially unfree knights, known as ministeriales, in the service of the Abbey of Lorsch, and later on vassals of the Prince Electors of the Palatinate. The dynasty died out when the last knight of Handschuhsheim, Johannes (Hans) V., died aged 16 on 31st December 1600 from injuries sustained in a duel. Through inheritance, the Tiefburg became the property of the barons of Helmstatt (who became counts of Helmstatt in the 18th century).
Tiefburg was badly damaged in the Thirty Years‘ War. In 1689 it fell victim to the War of the Palatine Succession and became uninhabitable, whereupon the Helmstatts built a new residence in the immediate vicinity. The original gate of this new residence can still be seen to the east of the square in front of the Tiefburg. Count Raban von Helmstatt had the Tiefburg restored in the years 1910 to 1913.References:
First record of Kastelholma (or Kastelholm) castle is from the year 1388 in the contract of Queen Margaret I of Denmark, where a large portion of the inheritance of Bo Jonsson Grip was given to the queen. The heyday of the castle was in the 15th and 16th centuries when it was administrated by Danish and Swedish kings and stewards of the realms. Kastelhoma was expanded and enhanced several times.
In the end of 16th century castle was owned by the previous queen Catherine Jagellon (Stenbock), an enemy of the King of Sweden Eric XIV. King Eric conquered Kastelholma in 1599 and all defending officers were taken to Turku and executed. The castle was damaged under the siege and it took 30 years to renovate it.
In 1634 Åland was joined with the County of Åbo and Björneborg and Kastelholma lost its administrative status.