The Free and Hanseatic City of Lübeck was a city-state from 1226 to 1937. In 1226 Emperor Frederick II declared the city of Lübeck to be a Free Imperial City. Lübeck law was the constitution of the city's municipal form of government developed after being made a free city. In theory, Lübeck law made the cities which had adopted it independent of royalty. In the 14th century Lübeck became the "Queen of the Hanseatic League", being by far the largest and most powerful member of this medieval trade organization.
The Hanseatic League, under Lübeck´s leadership, fought several wars against Denmark with varying degrees of success. Whilst Lübeck and the Hanseatic League won in 1435 and 1512, Lübeck lost when it became involved in the Count's Feud, a civil war that raged in Denmark from 1534 to 1536. Lübeck remained neutral in the Thirty Years' War, but with the devastation of the war and the new transatlantic orientation of European trade, the Hanseatic League, and thus Lübeck, lost importance. After the de facto disbandment of the Hanseatic League in 1669, Lübeck remained an important trading town on the Baltic Sea.