(3 May 996–18 Feb. 999)
When Emperor Otto III (996–1002), moving from Germany in response to John XV's appeal for help, reached Pavia at Easter 996, he learned that the pope was dead (March). Soon a delegation of the Roman nobility waited on him at Ravenna begging him to nominate a new pontiff; their attitude was a measure of their fear of his anger at their maltreatment of John XV. Otto chose a 24-year-old relative born in 972, Bruno, son of his cousin Duke Otto of Carinthia, a priest of first-rate education who had gained experience of business in the royal chapel. Accompanied by Archbishop Willigis of Mainz and Bishop Hildibald of Worms, Otto's chancellor, Bruno went to Rome, was formally elected, and at his consecration as the first German pope took the name Gregory V, adopting Gregory the Great (590–604) as his model. On Ascension day (21 May) he crowned Otto, who had arrived at Rome with a substantial army, as emperor and patrician in St Peter's, making him thus protector of the church. On 22 May Otto passed judgement on the dictator Crescentius II Nomentanus, who had persecuted John XV; he was sentenced to banishment, but was pardoned on the ill-advised intercession of Gregory, who was hoping to conciliate the powerful Roman families. Meanwhile, as the new pope asserted his independence and began adopting the curia's point of view as his own, relations quickly became clouded between him and the emperor. Otto refused both to renew the pact with the holy see which Emperor Otto I (962–73) had issued in his own and his son's names, and to restore the Pentapolis (part of the donation of Pepin) to the papal state, as Gregory demanded. For his part Gregory did not hesitate (May 996) to declare Gerbert (future pope Silvester II), whom John XV had suspended but who had become a close friend of Otto, an intruder on the see of Reims and his deposed predecessor Arnoul its lawful bishop (988–1021)
In early June Otto left Rome, seeking a cooler climate. A month later Gregory, by now aware of the resentment aroused in Rome by the appointment of a foreign pope and feeling his position threatened, besought him to return, but he declined, pleaded ill-health, and referred him to the dukes of Tuscany and Spoleto for protection. In early Oct., Otto being now in Germany, the Romans led by Crescentius II revolted and drove Gregory, stripped of everything, out of the city. He sought refuge in Spoleto, and although he made two armed attempts to recover Rome they both failed.
In Jan. 997 Gregory moved to Lombardy, where he held discussions with local bishops; probably also with John Philagathos, a former tutor of Otto's and now archbishop of Piacenza, recently returned from a diplomatic mission to Byzantium. In early Feb. he held a synod at Pavia at which Crescentius was excommunicated and the old rules (going back to Symmachus, 1 Mar. 499) prohibiting agreements about his successor during a pope's lifetime and the purchase of clerical offices with money were re-enacted. Earlier in the month, though Gregory did not learn of it until after the synod, on the pretext that the papal throne was vacant, Crescentius and his adherents, with active support from the Byzantine envoy Leo, had John Philagathos elected and installed with the title of John XVI. The usurper was soon excommunicated by the western episcopate, but as the emperor had immediate preoccupations in Germany it was only in Feb. 998 that he could take possession of Rome. Here Gregory, finally restored, presided over a synod possibly in early May at which John Philagathos, already appallingly mutilated, was deposed and imprisoned in a monastery; Crescentius had already been beheaded on the battlements of Castel Sant'Angelo.