In 814 the Carolingian emperor Louis the Pious made the Christian mission in the German stem duchy of Saxony the episcopal see of the Diocese of Halberstadt. It was vested with market rights by King Otto III in 989. The town became the administrative centre of the Saxon Harzgau and an important trading location. The Halberstadt bishops had the Church of Our Lady erected from about 1005 onwards. In his fierce conflict with Emperor Frederick Barbarossa, the forces of the Saxon duke Henry the Lion devastated the town in 1179.