The history of the papacy from 1046 to 1216 was marked by conflict between popes and the Holy Roman Emperor, most prominently the Investiture Controversy, a dispute over who— pope or emperor— could appoint bishops within the Empire. Henry IV's Walk to Canossa in 1077 to meet Pope Gregory VII (1073–85), although not dispositive within the context of the larger dispute, has become legendary. Although the emperor renounced any right to lay investiture in the Concordat of Worms (1122), the issue would flare up again.
The Imperial crown once held by the Carolingian emperors was disputed between their fractured heirs and local overlords; none emerged victorious until Otto I, Holy Roman Emperor invaded Italy. Large parts of northern and central Italy became a constituent kingdom of the Holy Roman Empire in 962, from which point emperors were Germanic. As emperors consolidated their position, northern Italian city-states would become divided by Guelphs and Ghibellines.