Although Rome had lost most of its million-person population it had had as the capital of the Roman Empire, it still played an important part in Europe, being the seat of the Pope. Unfortunately, the French kings even took this prestige from Rome, since Philippe III forced the Pope to take seat in Avignon in 1309. There was some resistance in Rome to this move, and the emperors of the HRE helped - suchOttokar II, who was crowned Emperor in Rome - not by the Pope, but by the head of the mighty Colonna family.
In 1370, Pope Clemens VII agreed after diplomatic pressure (and because the growing unrest in Italy even endangered the Papal States) to return to Rome. The Great Reform council of Geneva 1401-07 also explicitly stated that the Pope had to stay in Rome (the Italians had insisted particularly on that).
But when the Rum-Seljuks threatened the Papal States in 1459-61, the helpless Pope fled to Avignon again.
In 1466 the infamous Sacco di Roma happened. Castille-Portugal sent troops to Italy to fight for the Pope; but 1472, after lots of fighting, the Seljuks kept Latium, calling themselves from now on "rulers of both Romes". (This was despite the fact that the Sultan was disappointed how insignificant Rome had 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 (Castille). Although no-one said it out loud, the Pope and the other church leaders were quite content in Avignon and didn't care that much about Rome any more. Many people criticized the Pope and the Catholic church for the decision, and this may have led to the Occidental Schism.
Returning pilgrims spread the news that Rome was conquered by the infidels. Many sects believed that the end of time was near (the date of 1500 was often mentioned). At first the war gave them hope that Rome could be reconquered, but when Castille-Portugal gave up Rome in 1472, they became desperate. Unrest spread in many European countries.
Under Seljuk rule
1542, a great uprising of the Carbonari happened in South Italy, which soon spread to Rome itself. Florence used the opportunity and invaded Latium. Many volunteers went to Italy to fight against the Seljuks; some pious nobles, mainly from Castile and Portugal, supported Florence with money. In 1543, Florentine troops stood in Naples and the Marches. Now however, the main army of the Seljuks arrived, and the Florentine army was defeated several times. The chaos allowed many carbonari to leave South Italy and flee to safer places, however. But in 1544 the Seljuks again took control. The people of Rome had to leave their city, which the Sultan wanted to settle anew with Muslims. Some of them even went to Atlantis, but others swore to retake Rome at the earliest opportunity.
1556, 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 gave up Latium to Florence. The victorious Italians demanded that the Pope should return to Rome, which the French king denied. But there also was another problem: Who should govern liberated Rome? In the end, the compromise was made that Florence would administer Latium, although the latter would formally stay under the Pope. But the idea that Rome should become capital of a united Italy had been established.