In the later middle ages there was a fight to have power over who got to choose the bishops for the church. This started in 1073 and finally a pope and a king made a compromise in 1122 and the fight stopped.
Pope Leo IX
Pope Gregory disproved of King Henry's decision on the bishop he choose. Then the chaos began King Henry tried to make Gregory get removed for the position of pope. Then Pope Gregory VII excommunicated King Henry IV. Later the king asked for forgiveness but Gregory refused to see him. Eventually he forgave him but took a while to accept the appology.
King Henry IV piked who he though was right for the bishop position. The Pope questioned his authority and he tried to get rid of the of Gregory and have someone else be pope. For this act the pope made the king so he couldn't come to the church any longer. After this Henry begged for forgiveness because he knew his act was wrong.
Pope Leo IX took the throne in 1049 before Gregory. He tried to convince people to be on the popes side because the first pope Saint Peter had control over all Christian churches later popes should have the same power. Despite all of his attempts leaders in Europe refused to recognize the supremacy of the pope. Leo excommunicated the person who had said this, and is known as the Great Schism.
King Henry IV begged the pope for forgiveness but the pope refused. Desperate to be let back into the church Henry waited out side the Popes door in the snow barefoot for 3 days straight. Eventually Gregory accepted his apology and allowed him back to the church. At that point Gregory proved himself more powerful than an emperor.
The fight over the right to choose the bishop continued even after Henry and Gregory died in 1122. a new pope and emperor reached a compromise eventually. Church officials would choose all bishops and abbots. The bishops and abbots however would have to obey the emperor. This compromize changed the lives all over Europe.