Three evils plagued the Church then: simony (the buying and selling of sacred offices and things), the unlawful marriage of the clergy and lay investiture (kings and nobles controlling the appointment of Church officials). To all of these Hildebrand directed his reformers attention, first as counselor to the popes and later (1073-1085) as pope himself.
Gregorys papal letters stress the role of bishop of Rome as the vicar of Christ and the visible center of unity in the Church. He is well known for his long dispute with Holy Roman Emperor Henry IV over who should control the selection of bishops and abbots.
Gregory fiercely resisted any attack on the liberty of the Church. For this he suffered and finally died in exile. He said, I have loved justice and hated iniquity; therefore I die in exile. Thirty years later the Church finally won its struggle against lay investiture.