Right where the Citadel stands today was once a castle. During the time of the knights castles were important to defend the area. Therefore they were surrounded by a sturdy wall. At one point in history even the thickest castle walls were not strong enough anymore and the people started to build fortresses with even thicker walls.
To defend the fortress and the area at any time, many soldiers lived here in the fortress. In dangerous times, like an attack, the people living in surrounding areas could seek shelter in the fortress. The Citadel is such a fortress.
The thick walls still exist today, even though it is not dangerous here anymore. Since it is not dangerous there is no need for soldiers to live here nowadays. Instead there are loads of interesting things to discover. That makes living here so much more enjoyable than it was at the times of my great-great-great-great-grandmother Kunigunde.