It began as a dispute in the 11th century between the Holy Roman Emperor Henry IV and Pope Gregory VII . It began as a dispute in the 11th century between the Holy Roman Emperor Henry IV , and Pope Gregory VII concerning who would appoint bishops ( investiture ) .