Toompea Castle is situated on the steep limestone hill in the central part of Tallinn. The first wooden castle is believed to have been built on the hill in either the 10th or 11th century by residents of the ancient Estonian county of Rävala. It was probably one of the first inhabited areas of what later became Tallinn. In 1219, the castle was taken over by Danish crusaders - led by Valdemar II. According to a legend very popular among Danes, the very first flag of Denmark (Dannebrog) fell from the sky during a critical stage of the Battle of Lyndanisse, fought near the castle, resulting in Danish victory over Estonians. The current castle is mainly constructed in the 13th and 14th centuries.
The castle is one of the most potent symbols of the reigning power, which over the centuries has been conquered by various nations. According to the Altmark peace treaty of 1629, Estonian territories went to the king of Sweden. In 1583–1589 a new ceremonial building, the State Hall building, was erected on Toompea. It was located against the western wall between Tall Hermann tower and the convent building.
In 1710 the ownership of Toompea went from the Swedes to the Russian Czarist Empire. The Russian Empress Catherine the Great ordered the construction of the Estonian Government Administration building in the east side of the fortress; it was completed in 1773.
On 24 February 1918, Estonia became an independent state. From 1920 until 1922, according to the plans of the architects Eugen Habermann and Herbert Johansen, the building of the Parliament (Riigikogu) was built in the castle courtyard. The expressionist design of the building makes it unique among the parliament buildings of the world. In 1935, the palatial south wing was built on the south side, copying the style of the Government Administration building, and the Governor's Garden was laid out in appropriate design.
The Toompea castle and the surrounding old town are is one of the best preserved medieval cities in Europe. Nineteen of the original sixty six defense towers are survived. The old town is in the list of UNESCO World Heritage Sites. The castle is open to the public with no charge. There are also guided services available.
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.