In 476, the last Western Roman emperor Romulus Augustus, a puppet (like almost all emperors of this period) in the hands of a general, his father Orestes, was deposed by a riot of barbarian troops led by Odoacer and exiled to Naples. The fall of the Western Roman Empire had little impact on Rome. Odoacer and later the Ostrogoths continued, like the last emperors, to rule Italy from Ravenna. Meanwhile, the Senate, even though long since stripped of wider powers, continued to administer Rome itself, with the Pope usually coming from a senatorial family. This situation continued until the forces of the Eastern Roman Empire, sent West by Justinian I under Belisarius, captured the city in 536.
On December 17, 546, the Ostrogoths under Totila recaptured and sacked the city. The Byzantine general Belisarius recaptured Rome, but the Ostrogoths retook it in 549. Belisarius was replaced by Narses, who captured Rome from the Ostrogoths for good in 552, ending the so-called Gothic Wars which had turned much of Italy into desert. The continual war around Rome in the 530s and 540s left it in a state of total disrepair - near abandoned and desolate with much of its environment turned into an unhealthy marsh. The aqueducts were never repaired, leading to a shrinking population of less than 50,000 concentrated near the Tiber and around Campo Marzio, abandoning those districts without water supply. There is a legend, significant though untrue, that there was a moment where no-one remained living in Rome.
Eastern Roman Emperor Justinian I (reigned 527–565) tried to grant Rome subsidies for the maintenance of public buildings, aqueducts and bridges - though, being mostly drawn from an Italy dramatically impoverished by the recent wars, these were not always sufficient. He also styled himself the patron of its remaining scholars, orators, physicians and lawyers in the stated hope that eventually more youths would seek a better education. After the wars, the Senate was theoretically restored, but under the supervision of a prefect and other officials appointed by, and responsible to, the Byzantine authorities in Ravenna.
However, the Pope was now one of the leading religious figures in the entire Byzantine Empire and effectively more powerful locally than either the remaining senators or local Byzantine officials. In practice, local power in Rome devolved to the Pope and, over the next few decades, both much of the remaining possessions of the senatorial aristocracy and the local Byzantine administration in Rome were absorbed by the Church.
The reign of Justinian's nephew and successor Justin II (reigned 565–578) was marked from the Italian point of view by the invasion of the Lombards under Alboin (568). In capturing the regions of Benevento, Lombardy, Piedmont, Spoleto and Tuscany, the invaders effectively restricted Imperial authority to small islands of land surrounding a number of coastal cities, including Ravenna, Naples, Rome and the area of the future Venice. The one inland city continuing under Byzantine control was Perugia, which provided a repeatedly threatened overland link between Rome and Ravenna. In 578 and again in 580, the Senate, in its last recorded acts, had to ask for the support of Tiberius II Constantine (reigned 578–582) against the approaching Dukes, Faroald of Spoleto and Zotto of Benevento.
Maurice (reigned 582–602) added a new factor in the continuing conflict by creating an alliance with Childebert II of Austrasia (reigned 575–595). The armies of the Frankish King invaded the Lombard territories in 584, 585, 588 and 590. Rome had suffered badly from a disastrous flood of the Tiber in 589, followed by a plague in 590. The latter is notable for the legend of the angel seen, while the newly elected Pope Gregory I (term 590-604) was passing in procession by Hadrian's Tomb, to hover over the building and to sheathe his flaming sword as a sign that the pestilence was about to cease. The city was safe from capture at least.
Agilulf, however, the new Lombard King (reigned 591 to c. 616), managed to secure peace with Childebert, reorganized his territories and resumed activities against both Naples and Rome by 592. With the Emperor preoccupied with wars in the eastern borders and the various succeeding Exarchs unable to secure Rome from invasion, Gregory took personal initiative in starting negotiations for a peace treaty. This was completed in the autumn of 598- only later recognized by Maurice. It would last till the end of his reign.
The position of the Patriarch of Rome was further strengthened under the usurper Phocas (reigned 602–610). Phocas recognized the primacy over that of the Patriarch of Constantinople and even decreed Pope Boniface III (607) to be "the head of all the Churches". Phocas' reign saw the erection of the last imperial monument in the Roman Forum, the column bearing his name. He also gave the Pope the Pantheon, at the time closed for centuries, and thus probably saved it from destruction.
During the 7th century, an influx of both Byzantine officials and churchmen from elsewhere in the empire made both the local lay aristocracy and Church leadership largely Greek speaking. However, the strong Byzantine cultural influence did not always lead to political harmony between Rome and Constantinople. In the controversy over Monothelitism, popes found themselves under severe pressure (sometimes amounting to physical force) when they failed to keep in step with Constantinople's shifting theological positions. In 653, Pope Martin I was deported to Constantinople and, after a show trial, exiled to the Crimea, where he died.
Then, in 663, Rome had its first imperial visit for two centuries, by Constans II - its worst disaster since the Gothic Wars when the emperor proceeded to strip Rome of metal, including that from buildings and statues, to provide armament materials for use against the Saracens. However, for the next half century, despite further tensions, Rome and the Papacy continued to prefer continued Byzantine rule - in part because the alternative was Lombard rule, and in part because Rome's food was largely coming from Papal estates elsewhere in the Empire, particularly Sicily.
However, in 727, Pope Gregory II refused to accept the decrees of Emperor Leo III, establishing iconoclasm. Leo reacted first by trying in vain to abduct the Pontiff, and then by sending a force of Ravennate troops under the command of the Exarch Paulus, but they were pushed back by the Lombards of Tuscia and Benevento. On November 1, 731, a council was called in St. Peter by Gregory III to excommunicate the iconoclasts. The Emperor responded by confiscating large Papal estates in Sicily and Calabria and transferring areas previously ecclesiastically under the Pope but still under Byzantine control to the Patriarch of Constantinople. In effect, Rome had been expelled from the Byzantine Empire.
In this period the Lombard kingdom was living an age of revival under the strong Liutprand. In 730 he razed the countryside of Rome to punish the Pope who had supported the duke of Spoleto. Though still protected by his massive walls, the pope could do little against the Lombard king, who managed to ally himself with the Byzantines. Other protectors were now needed. Gregory III was the first Pope to ask for concrete help from the Frankish Kingdom, then under the command of Charles Martel (739).
Liutprand's successor Aistulf was even more aggressive. He conquered Ferrara and Ravenna, ending the Exarchate of Ravenna. Rome seemed his next victim. In 754, Pope Stephen II went to France to name Pippin the Younger, king of the Franks, as patricius romanorum, i.e. protector of Rome. In the August of that year the King and Pope together crossed back the Alps and defeated Aistulf at Susa. When Pippin went back to St. Denis however, Aistulf did not keep his promises, and in 756 besieged Rome for 56 days. The Lombards returned north when they heard news of Pippin again moving to Italy. This time he agreed to give the Pope the promised territories, and the Papal States were born.
In 771 the new King of the Lombards, Desiderius, devised a plot to conquer Rome and seize Pope Stephen III during a feigned pilgrimage within its walls. His main ally was one Paulus Afiarta, chief of the Lombard party within the city. However the plan failed, and Stephens' successor, Pope Hadrian I called Charlemagne against Desiderius, who was finally defeated in 773. The Lombard Kingdom was no more, and now Rome entered into the orbit of a new, greater political institution.
St. Peter's of Rome