Bamberg (, US also , German: [ˈbambɛʁk] (listen)) is a town in Upper Franconia, Germany, on the river Regnitz close to its confluence with the river Main. The town dates back to the 9th century, when its name was derived from the nearby Babenberch castle. Cited as one of Germany's most beautiful towns, its old town has been a UNESCO World Heritage Site since 1993, with Bamberg being home to Europe's largest intact old city wall.
From the 10th century onwards, Bamberg became a key link with the Slav peoples, notably those of Poland and Pomerania. It experienced a period of great prosperity from the 12th century onwards, during which time it was briefly the centre of the Holy Roman Empire. Emperor Henry II was also buried in the old town, alongside his wife Kunigunde. The town's architecture from this period strongly influenced that in Northern Germany and Hungary. From the middle of the 13th century onwards, the bishops were princes of the Empire and ruled Bamberg, overseeing the construction of monumental buildings. This growth was complemented by the obtaining of large portions of the estates of the Counts of Meran in 1248 and 1260 by the see, partly through purchase and partly through the appropriation of extinguished fiefs.
Bamberg lost its independence in 1802, following the secularization of church lands, becoming part of Bavaria in 1803. The town was first connected to the German rail system in 1844, which has been an important part of its infrastructure ever since. After a communist uprising took control over Bavaria in the years following World War I, the state government fled to Bamberg and stayed there for almost two years before the Bavarian capital of Munich was retaken by Freikorps units (see Bavarian Soviet Republic). The first republican constitution of Bavaria was passed in Bamberg, becoming known as the Bamberger Verfassung (Bamberg Constitution).
Following the Second World War, Bamberg was an important base for the Bavarian, German, and then American military stationed at Warner Barracks, only closing in 2014.