The Papal States in the center of Italy were directly owned by the pope since Charlemagne. His grip became weaker however since king Philippe III of France forced him to take his seat in Avignon in 1303/09. Only in 1370, pope Clemens VII agreed after diplomatic pressure (and because the growing unrest in Italy endangered the Papal States) to return to Rome. But when the Rum-Seljuks first landed in Naples and later took all of it, the pope again fled to Avignon.
The second fall of Rome
1466, the infamous Sacco di Roma happened. In the following years, the church lost a lot of power to the various state governments (whether monarchical, republican or something in between). The fact that the "Constantine donation" had been discovered to be a forgery didn't help the pope either. Castille-Portugal sent troops to Italy to fight for the pope, though. But in 1472, after lots of fighting, the Rum-Seljuks kept Latium, calling themselves from now on "rulers of both Romes". Despite the fact that the sultan was disappointed how insignificant Rome has become. The eastern parts of the Papal States became the Duchy/Protectorate of the Marches, theoretically still under the pope, de facto under the duke of Alba (from Castille). Although no one said it loud, the pope and the other church leaders were quite content in Avignon and didn't care that much about Rome any more.
Under Florentine / Italian rule
1556, the Triple Monarchy of England-Castille-Portugal declared war on the Seljuks, enraged over the fate of Rome. Savoy and Florence joined the war. In 1559, Rome was reconquered by Christians; all the Muslims found there were massacred. In the peace of Ostia 1565 the Seljuks had to give up Latium (to Florence) and the Marches (the duchy was re-established) to the Triple Monarchy of England-Castille-Portugal. The Romans displaced ~20 years ago returned in triumph. The victorious Italians demanded that the Pope returned to Rome, which the French king denied. So it was decided that while Latium was theoretically again under the pope, Florence would do the real administration - for the Seljuk threat, the popes didn't really want to return.
After the Triple Monarchy of England-Castille-Portugal fell apart in 1628, the Florentines finally part with them in 1631, since the Florentines wanted to annex the Duchy of the Marches. They had to make a compromise with France: While the former Papal States would still be nominally under the pope, Florence would "administrate" it for him. This was also seen as a compensation for the pope staying in Avignon, while many Italians still wished for his return to Rome. In addition, Florence had to allow France's ally Venice to annex the more valuable North: Bologna, Ferrara and Ravenna.