Nuremberg is a city in the German state of Bavaria, in the administrative region of Middle Franconia. Situated on the Pegnitz river and the Rhine–Main–Danube Canal, it is located about north of Munich. It is the second-largest city in Bavaria (after Munich), and is the largest in Franconia. The population as of December 2011, is 510,602, which makes it Germany's fourteenth largest city. The "European Metropolitan Area Nuremberg" has 3.5 million inhabitants.HistoryMiddle Ages, according to the first documentary mention of the city in 1050, as the location of an Imperial castle between the East Franks and the Bavarian March of the Nordgau. From 1050 to 1571, the city expanded and rose dramatically in importance due to its location on key trade routes. King Conrad III established a burgraviate, with the first burgraves coming from the Austrian House of Raab but, with the extinction of their male line around 1190, the burgraviate was inherited by the last count's son-in-law, of the House of Hohenzollern. From the late 12th century to the Interregnum (1254–73), however, the power of the burgraves diminished as the Hohenstaufen emperors transferred most non-military powers to a castellan, with the city administration and the municipal courts handed over to an Imperial mayor from 1173/74. The strained relations between the burgraves and the castellan, with gradual transferral of powers to the latter in the late 14th and early 15th centuries, finally broke out into open enmity, which greatly influenced the history of the city.