as a defence against The city takes its name from the first permanent building on the site, a fortress ordered built by Emperor Charlemagne in 808 AD. The castle was built on rocky ground in a marsh between the River Alster and the River ElbeSlavic incursion. The castle was named Hammaburg, where burg means fortress. The origin of the Hamma term remains uncertain, as does the exact location of the fortress.