Henry IV inherited the great German Empire at the age of six. His father, Henry III, had recently died and he was the eldest son. Before his death, Henry III had agreed with the German nobility that his son could indeed become king. Because that didn't always make sense at the time. The church was as powerful as the king. Many noblemen were also clergy in this era. This meant that they belonged to the church. When Henry IV was four years old, he was crowned king by the Archbishop of the City of Cologne.
When Henry IV was 15 years old, he was allowed to rule legally. In the era of the Middle Ages, you grew up when you turned 15. A year later, he married the girl he had been engaged to for 10 years: Bertha van Savoy. When Henry was too young to be king, his mother observed for him. So his mother became regent. But the church power did not accept her rule. Hendrik's mother wanted to keep the power of the Church as small as possible. Henry and his mother were persecuted when he was 12 years old. Henry's mother had to give power to the bishops. This is what she did.
Henry IV has had a fight with the Catholic Church all his life. His father and his mother had always fought against the power of the Church and Henry IV did exactly the same. Normally, only the pope was allowed to appoint bishops. And only the Pope was allowed to crown someone emperor. Henry IV felt he was more important and powerful than the Pope. He has appointed many bishops. Those bishops were loyal to Henry IV. This infuriated the Pope.
In 1073, Pope Gregory VII was elected. Pope Gregory VII wanted to regain power. Henry and Gregory had an open argument in 1076 over the appointment of the Bishop of Milan. The appointment of a bishop is called investiture. The battle between the Pope and the king is called the Investiture Battle. This battle was very decisive for the history of the Middle Ages. Gregory thought Henry had gone too far and excommunicated Henry IV. This actually meant he was outlawed. His name and his title were no longer worth anything. No one had to listen to this Henry anymore.
This showed that the Pope had even more power than the king during this period of history. Henry had to go to Canossa to show his remorse. Here stood the Pope's castle. The Pope made him wait three days in front of the gate before the excommunication was undone.
Gregorius and Henry had nevertheless not buried the hatchet. Gregory went looking for a replacement for Henry. He sought adelen who would support him to oust Henry as king. This resulted in a war. In the year 1084 Henry had had enough. He expelled gregory from Rome and appointed himself a new pope. This new pope has crowned Henry emperor. So it was that Henry became emperor of the Holy Roman Empire at the age of 34.
The Investiture battle lasted until 1122. In this year the concordat of Worms was drawn up. This was an agreement between Pope Calixtus II and Henry IV's son, Henry V. This agreement stated that the emperor could no longer appoint bishops. This was the beginning of the separation between church and state. The bishops were now no longer the ruler of an area.