In 1219, Tallinn was taken by the Danes. It was then that a new fortress was built on Toompea Hill. The city had a thriving trade-based economy, mainly due to its membership in the Hanseatic League beginning in 1285. The city was sold to the Teutonic Knights in 1346, until after the order was dissolved in 1561, when it found itself a possession of Sweden. Tallinn was taken by Peter the Great in 1710, and continued to be part of Russia until the period from 1918 to 1940, when it was the capital city of independent Estonia. From 1940 to 1991, Estonia was part of the USSR. German troops occupied and seriously damaged the city from 1941 to 1944. In 1991, Tallinn became the capital of a democratic Estonian state after the Supreme Soviet of Estonia declared itself independent.
Many citizens of citizens of Tallinn found themselves deported and jailed by the Soviets in 1940, and then later in 1944-49, for charges of conspiring and collaborating with the Nazis as well as resistance to collectivization. Of the many exiled, a large percentage settled in Sweden or North America. In their place, a great many Russians moved to Tallinn and now make up 40% of the population. About half of the population now consists of Ethnic Estonians.
There are many surviving relics located on Toompea Hill and in the Lower Town, among them the Toom Church, Gothic Niguliste and Oleviste Churches, the Great Guildhall dating from 1410, the Rathus and a great portion of the old castle. In 1997, the historical center of the city became a UNESCO World Heritage Site.
Currently, Tallinn is a key commercial and fishing seaport and industrial city. Producing a range of products, from ships to machinery, as well as many consumer goods, Tallinn is also the cultural centre of Estonia, with an academy of sciences, fine arts, and teacher-training institutes, as well as a music conservatory and several theatres and museums.
A regatta was held at Pirita, which is the north-eastern part of Tallinn, as part of the 1980 Summer Olympics. Several buildings, such as the Hotel Olümpia, the new Main Post Office, and the Regatta Center were constructed especially for the Olympics.