Tallinn received Lübeck city rights in 1248, however the earliest evidence of human settlement in the area dates back nearly 5,000 years. The first recorded claim over the place was laid by Denmark in 1219, after a successful raid of Lyndanisse led by King Valdemar II, followed by a period of alternating Scandinavian and Teutonic rulers. Tallinn was known as one of the most important medieval ports in the Gulf of Finland together with Turku; due to its strategic location in the Baltic Sea, the city became a significant trade hub, especially from the 14th to the 16th century, when it grew in importance as part of the Hanseatic League. Tallinn's Old Town in Kesklinn is one of the best preserved medieval cities in Europe and is listed as a UNESCO World Heritage Site.Tallinn has the highest number of start-ups per person among European countries and is the birthplace of many international high technology companies, including Skype and Wise. The city is home to the headquarters of the European Union's IT agency, and to the NATO Cyber Defence Centre of Excellence.
In 2007, Tallinn was listed among the top ten digital cities in the world. The city was a European Capital of Culture for 2011, along with Turku in Finland.