The history of Saxony-Anhalt began with Old Saxony, which was conquered by Charlemagne in 804 and transformed into the Duchy of Saxony within the Carolingian Empire. Saxony went on to become one of the so-called stem duchies of the German Kingdom and subsequently the Holy Roman Empire which formed out of the eastern partition of the Carolingian Empire. The duchy grew to become a powerful state within the empire, ruling over much of what is now northern Germany, but following conflicts with the emperor it was partitioned into numerous minor states around the end of the 12th century.