The area around L�beck was settled after the last Ice Age. Several Neolithic dolmens can be found in the area.
Around AD 700 Slavic peoples started coming into the eastern parts of Holstein which had previously been settled by Germanic inhabitants and were then evacuated in the course of the Migration Period. In the early 9th century Charlemagne, whose attempts to Christianise the area were opposed by the Saxons, moved the Saxons out and brought in Polabian Slavs, allied to Charlemagne, in their stead. Liubice ("lovely") was founded on the banks of the river Trave about four kilometres north of the present-day city centre of L�beck. In the 10th century it became the most important settlement of the Obotrite confederacy and a castle was built. The settlement was burned down in 1128 by the pagan Rani from R�gen.
The modern town was founded by Adolf II, Count of Schauenburg and Holstein, in 1143 as a German settlement on the river island Bucu. He established a new castle which was first mentioned by Helmold in 1147. Adolf had to cede the castle to Henry the Lion in 1158. After Henry's fall from power in 1181, the town became an Imperial city for eight years. Emperor Barbarossa ordained that the city should have a ruling council of twenty members. Being dominated by merchants, it meant L�beck's politics were dominated by trade interests for centuries to come. The council survived into the 19th century.
The town and castle changed ownership for a period afterwards and were part of the Duchy of Saxony until 1192, of the County of Holstein until 1217 and part of Denmark until the Battle of Bornh�ved in 1227.
Around 1200 the port became the main point of departure for colonists leaving for the Baltic territories conquered by the Livonian Order and, later, Teutonic Order. In 1226 Emperor Frederick II elevated the town to the status of an Imperial Free City, by which it became the Free City of L�beck. In the 14th century L�beck became the "Queen