The 9th century, from 801 to 900, started with the process of building a new power structure in Rome after the ties to first the Byzantine Empire and then the Lombards had been severed in the preceding century. But in 814, Charlemagne died and left a vacuum behind. The Pope had the document known as the Donation of Constantine to support his claim to power in the Papal States, but that document was already disputed, and few pontiffs were able to assert it. During this century, the noble families of Rome started fighting over the papacy, leaving the institution weakened.
In addition to the internal crisis, Italy was also attacked by Saracens. In 846, they sacked San Pietro in Vaticano, which was outside the city walls. As a result, Pope [[Leo IV built the walls around the Vatican, known as the Leonine City.