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.