Seaport city (pop., 2003 est.: 400,378), capital of Estonia. It is located on the Gulf of Finland. A fortified settlement existed there from the late 1st millennium BC and a town in the 12th century AD. In 1219 it was captured by the Danes, who built a new fortress. Trade flourished after it joined the Hanseatic League in 1285. In 1346 it was sold to the Teutonic Order, and in 1561 it passed to Sweden. Russia captured it in 1710, and it remained a Russian city until 1918, when it became the capital of independent Estonia. From 1940 to 1991 Estonia was a republic of the U.S.S.R. During World War II the city was occupied by German forces and was severely damaged. Rebuilt, it again became the capital of independent Estonia in 1991. It is a major commercial and fishing port, an industrial centre, and the cultural focus of Estonia, with numerous educational institutions. Historical structures include a medieval city wall and a 13th-century church. Tallinn's historic centre was designated a UNESCO World Heritage site in 1997.