By the 10th century, the condition of the church had deteriorated significantly. It had fallen under what is known as lay control. This means that many people holding clerical offices had been selected and invested by laymen, that is, people not ordained in the Church. Lords, Dukes, and other noblemen were appointing priests, Bishops and Abbots. In addition to this abuse, some clerics were not celibate, and some even bought their offices.
The Bishops and Abbots appointed by the noblemen operated as Vassals, and were subject to their Lords. Bishops were strategically perfect as local administrators, because they could not have legitimate children, and thus have no heirs. This would prevent the establishment of dynasties that could grow in power and possibly threaten the noblemen who appointed them. This is precisely what happened in the case of the switch from the Carolingian to the Merovingian dynasty, in which the Carolingians had become powerful in the palace and eventually had the Merovingian King deposed. One of the effects of lay control was a severe loss of spiritual rigor among the clergy, because they were being appointed for political reasons, and not spiritual ones.
It was clear that some reform was needed. Pope Leo IX (r.1049-1054) made a moderate reform of the Church. He condemned clerical marriage, simony (the buying or selling of Church offices), and other abuses. He also addressed lay control, but not forcefully enough to induce real change, hence “moderate” reform. Instead of abolishing lay control altogether, he said that laymen should appoint competent individuals. Although this may have diminished the number of “bad” Bishops, it did not address the issue of why laymen were appointing clerics in the first place.
Obviously, a new, more concrete reform was in order. Pope Gregory VII (r. 1073-1085) realized that the only way to get any reforms to stick was to completely abolish lay investiture altogether. He held a council in 1075, in which all clergy invested by laymen were deposed, and all laymen who did any investing were excommunicated. This probably would have been the end of the investiture controversy, if Henry VI, Holy Roman Emperor, had not needed his own loyal Bishops for a political agenda.
Henry VI appointed Bishops in Milan and other places to offset the power of local noblemen. He then summoned a synod of Bishops in 1076 and declared Gregory VII deposed. Gregory responded by having Henry and all of the Bishops who declared him deposed excommunicated. With tensions rising and the threat of rebellion looming, Henry went to see the Pope at his castle in Canossa to beg forgiveness. After making him wait for three days in the snow, Gregory lifted the excommunication and made Henry vow to comply with several conditions, which he did.
It is obvious that Henry VI was not serious about his vows, because after defeating the nobles who rose up against him, he promptly broke them, and was re-excommunicated by Pope Gregory. This time instead of begging forgiveness, Henry drove Gregory out of Rome and into exile, where he would remain until his death in 1085.
This whole lay investiture mess was finally resolved in 1122 at the Concordat of Worms. Pope Calixtus II (r. 1119-1124) and Holy Roman Emperor Henry V (r. 1111-1125) came to an agreement, which said that the king may be present at the election of a Bishop and may vest him with the symbols of his temporal office, but a representative of the Pope must vest him with the symbols of his spiritual authority. This agreement was ultimately viewed as a success for the Church, ending a long struggle for power between the Church and the state.