The city is not one that grew up with a civilian population although one did come along afterwards. It was the new seat of government and they weren't going to see it sacked again so they made sure there would be a few troops about.

I should also point out that it is also the centre of the nations navy and as such the training point for all new troops as well as holding the cities Garrison. The barracks within the walls house the King's personal guards

The city is roughly 1 mile across at it's widest point