In 1289, King Rudolf of Habsburg granted special privileges to the settlement in the river valley, making it an Imperial City. In 1525 the last property rights of the abbots in the Imperial City were sold in the so-called "Great Purchase", marking the start of the co-existence of two independent cities bearing the same name next to each other.
During the turmoil of the Thirty Years' War (1632–33), the city was destroyed by imperial forces.
During the Napoleonic Wars the Imperial City came under Bavarian rule (1802–03). In 1819, the city was united with the properties of the Abbey into a single communal entity.