In Medieval Europe, the Investiture Conflict was a long and bitter struggle for political supremacy between the secular authorities and the Papacy. At the heart of the conflict was the burning question: who had the right to appoint bishops, the Pope, or the secular ruler? Bishops weren't just clerical officials; they were wealthy, powerful figures who exercised considerable political as well as spiritual influence. The question of who should be responsible for appointing them, therefore, was a very serious one indeed.
The conflict started when reformers took control of the Papacy from Henry IV, the Holy Roman Emperor. As Henry was only six years old at the time, it was felt that this was the right time to strike. The reformers regarded the secular power of the Holy Roman Emperor as a major roadblock to stamping out corrupt practices in the Church, such as simony, the buying and selling of Church offices.
Under Gregory VII, the Papacy became more aggressive in asserting what it believed to be its God-given rights, including the sole right to appoint bishops. However, Henry IV, now no longer a child, defied the Pope and continued to appoint bishops within the Holy Roman Empire.
Inevitably, Henry's defiance led to serious conflict between the Holy Roman Empire and the Papacy, which resulted in Pope Gregory excommunicating Henry and deposing him as Emperor. Henry's political rivals were delighted by his deposition and rallied to the cause of the Papacy, largely for reasons of self-interest. Increasingly friendless and isolated Henry had no choice but to back down. In a very public act of penance, he apologized to the Pope and stood in the freezing snows of Canossa wearing a hair shirt.
This wasn't enough for Gregory, however, and he continued to support Henry's German rivals. This led to a period of further conflict, this time military, during which Henry's forces invaded Rome, forcing Gregory, who died not long after, to flee the Eternal City.
The Investiture Controversy rumbled on for decades, with a succession of Popes stirring up revolt in the Holy Roman Empire, which gradually chipped away at the Emperor's power and authority. By the time the conflict came to an end, the Papacy was in a stronger position than it had been for years, as the Pope emerged as a figure, indeed one of the few figures, in mainland Europe not to be subjected to the direct control of the Holy Roman Emperor.