As Gregory VII became pope Gregory, he made many changes. He detached the control over the papacy from the aristocrats, he fought against buying and selling of sacred offices and objects, and that only the pope should have the right to appoint bishops. However, King Henry IV, the roman emperor at the time, did not like this.
I'm s-sorry..... Please let me in.
FINE!
King Henry IV wanted to do something about this, he wanted more power than the pope, he wanted power over the bishops. King Henry was going to try and banish Pope Gregory.
ATTACK!!!!!
King Henry IV attempted to try and banish Pope Gregory. King Henry's plan backfired and he was excommunicated by Pope Gregory. After this King Henry begged Pope Gregory to be able to come back in, but it wouldn't work for awhile.
After 3 days of waiting, King Henry IV was allowed back into the city of Rome. King Henry IV and Pope Gregory continued their conflicts even after Henry's punishment. This made everything more intense.
King Henry has had enough with Pope Gregory and marched an army into the city. Henry's army pushed the pope out of the city, allowing King Henry to take full power. The pope made their way back in and conflict continued.
Pope and rulers conflict continued even after Pope Gregory and King Henry died. In 1122 however, This conflict was resolved with an agreement called the Concordat of Worms. This agreement permitted the pope the sole authority to appoint bishops, but the emperors to be able to appoint fiefs, or grants of land, to bishops in order to win their loyalty. Although this agreement stuck, conflict continued although not as bad as before.