The Holy Roman Empire was established in 936 by Otto I, who took the title of King of Germany. He worked closely with the Catholic Church, appointing bishops to government positions and sending troops to help the Pope. Over time, conflicts emerged between Popes and Holy Roman Emperors over who had the authority to appoint bishops. This struggle came to a head in the late 11th century between Pope Gregory VII and Emperor Henry IV over lay investiture. Their feud intensified as they exchanged insults, culminating in Gregory excommunicating Henry in 1076. The struggle dragged on for decades until the Concordat of Worms in 1122 established that the Church had sole power over spiritual authority while the emperor retained control