Hamburg, officially the Free and Hanseatic City of Hamburg, is the second largest city and a state of Germany, with a population of over 1.7 million people. The name Hamburg comes from the first permanent building on the site, a castle which the Emperor Charlemagne ordered constructed in AD 808. It rose on rocky terrain in a marsh between the River Alster and the River Elbe as a defence against Slavic incursion, and acquired the name Hammaburg