Oddly, the moat runs a bit outside of the city walls; there's a park that runs between the moat and the walls. Our tour guide said it's so the peasants can seek the protection of the city walls without actually being let inside the city.