Pope Gregory VII excommunicates Henry IV, Holy Roman Emperor.

Henry IV (German: Heinrich IV; 11 November 1050 7 August 1106) was Holy Roman Emperor from 1084 to 1105, King of Germany from 1054 to 1105, King of Italy and Burgundy from 1056 to 1105, and Duke of Bavaria from 1052 to 1054. He was the son of Henry III, Holy Roman Emperorthe second monarch of the Salian dynastyand Agnes of Poitou. After his father's death on 5 October 1056, Henry was placed under his mother's guardianship. She made grants to German aristocrats to secure their support. Unlike her late husband, she could not control the election of the popes, thus the idea of the "liberty of the Church" strengthened during her rule. Taking advantage of her weakness, Archbishop Anno II of Cologne kidnapped Henry in April 1062. He administered Germany until Henry came of age in 1065.

Henry endeavoured to recover the royal estates that had been lost during his minority. He employed low-ranking officials to carry out his new policies, causing discontent in Saxony and Thuringia. Henry crushed a riot in Saxony in 1069 and overcame the rebellion of the Saxon aristocrat Otto of Nordheim in 1071. The appointment of commoners to high office offended German aristocrats, and many of them withdrew from Henry's court. He insisted on his royal prerogative to appoint bishops and abbots, although the reformist clerics condemned this practice as simony (a forbidden sale of church offices). Pope Alexander II blamed Henry's advisors for his acts and excommunicated them in early 1073. Henry's conflicts with the Holy See and the German dukes weakened his position and the Saxons rose up in open rebellion in the summer of 1074. Taking advantage of a quarrel between the Saxon aristocrats and peasantry, he forced the rebels into submission in October 1075.

Henry adopted an active policy in Italy, alarming Pope Alexander II's successor, Gregory VII, who threatened him with excommunication for simony. Henry persuaded most of the German bishops to declare the Pope's election invalid on 24 January 1076. In response, the Pope excommunicated Henry and released his subjects from their allegiance. German aristocrats who were hostile to Henry called for the Pope to hold an assembly in Germany to hear Henry's case. To prevent the Pope from sitting in judgement on him, Henry went to Italy as far as Canossa to meet with the Pope. His penitential "Walk to Canossa" was a success and Gregory VII had no choice but to absolve him in January 1077. Henry's German opponents ignored his absolution and elected an antiking, Rudolf of Rheinfelden, on 14 March 1077. The Pope was initially neutral in the two kings' conflict, enabling Henry to consolidate his position. Henry continued to appoint high-ranking clerics, for which the Pope again excommunicated him on 7 March 1080. Most German and northern Italian bishops remained loyal to Henry and they elected the antipope Clement III. Rudolf of Rheinfelden was killed in battle and his successor, Hermann of Salm, could only exert royal authority in Saxony. From 1081, Henry launched a series of military campaigns to Italy, and Clement III crowned him emperor in Rome on 1 April 1084.

Hermann of Salm died and Henry pacified Saxony with the local aristocrats' assistance in 1088. He launched an invasion against the pope's principal Italian ally, Matilda of Tuscany, in 1089. She convinced Henry's elder son, Conrad II, to take up arms against his father in 1093. Her alliance with Welf I, Duke of Bavaria, prevented Henry's return to Germany until 1096 when he was reconciled with Welf. After Clement III's death, Henry did not support new antipopes, but did not make peace with Pope Paschal II. Henry proclaimed the first Reichsfriede (imperial peace) which covered the whole territory of Germany in 1103. His younger son, Henry V, forced him to abdicate on 31 December 1105. He tried to regain his throne with the assistance of Lotharingian aristocrats, but became ill and died without receiving absolution from his excommunication. Henry's preeminent role in the Investiture Controversy, his "Walk to Canossa" and his conflicts with his sons and wives established his controversial reputation, with some regarding him as the stereotype of a tyrant, and others describing him as an exemplary monarch who protected the poor.

Pope Gregory VII (Latin: Gregorius VII; c. 1015 – 25 May 1085), born Hildebrand of Sovana (Italian: Ildebrando di Soana), was head of the Catholic Church and ruler of the Papal States from 22 April 1073 to his death in 1085. He is venerated as a saint in the Catholic Church.

One of the great reforming popes, he is perhaps best known for the part he played in the Investiture Controversy, his dispute with Emperor Henry IV that affirmed the primacy of papal authority and the new canon law governing the election of the pope by the College of Cardinals. He was also at the forefront of developments in the relationship between the emperor and the papacy during the years before he became pope. He was the first pope in several centuries to rigorously enforce the Western Church's ancient policy of celibacy for the clergy and also attacked the practice of simony.

Gregory VII excommunicated Henry IV three times. Consequently, Henry IV would appoint Antipope Clement III to oppose him in the political power struggles between the Catholic Church and his empire. Hailed as one of the greatest of the Roman pontiffs after his reforms proved successful, Gregory VII was, during his own reign, despised by some for his expansive use of papal powers.Because this pope was such a prominent champion of papal supremacy, his memory was evoked on many occasions in later generations, both positively and negatively, often reflecting later writers' attitude to the Catholic Church and the papacy. Beno of Santi Martino e Silvestro, who opposed Gregory VII in the Investiture Controversy, leveled against him charges such as necromancy, torture of a former friend upon a bed of nails, commissioning an attempted assassination, executions without trials, unjust excommunication, doubting the Real Presence of the Eucharist, and even burning the Eucharist. This was eagerly repeated by later opponents of the Catholic Church, such as the English Protestant John Foxe. Twentieth century British writer Joseph McCabe describes Gregory as a "rough and violent peasant, enlisting his brute strength in the service of the monastic ideal which he embraced." In contrast, the modern historian of the 11th century H. E. J. Cowdrey writes, "[Gregory VII] was surprisingly flexible, feeling his way and therefore perplexing both rigorous collaborators ... and cautious and steady-minded ones ... His zeal, moral force, and religious conviction, however, ensured that he should retain to a remarkable degree the loyalty and service of a wide variety of men and women."