The Roman Question began when Rome was declared Capital of Italy on March 27, 1861, and ended with the Lateran Pacts between Mussolini's government and Pope Pius XI. After the capture of Rome on 20 September 1870, the popes considered themselves (in the words of Pope Pius IX) "prisoners in the Vatican".
After the Lateran Pacts were signed in 1929, the Popes regularly visited parts of Rome outside the Vatican. In particular, they took possession, after their election, of their cathedral, the Basilica of St. John Lateran, situated on the opposite side of the city. They also went to their summer residence at Castel Gandolfo, which has extraterritorial privileges, like an embassy, but is not part of Vatican City State. Travelling further afield began with Pope John XXIII, was extended outside Italy by Pope Paul VI and reached a climax with Pope John Paul II, whose travels outside Italy added up to three times the distance between the earth and the moon.
On February 18, 1861, the deputies of the first Italian Parliament assembled in Turin. On March 17, 1861, the Parliament proclaimed Victor Emmanuel II King of Italy, and on March 27, 1861 Rome was declared Capital of the Kingdom of Italy. However, the Italian Government could not take its seat in Rome because a French garrison, maintained there by Napoleon III of France, was defending Pope Pius IX. Following the signing of the September Convention, the seat of government was moved from Turin to Florence in 1865.
In July 1870, the Franco-Prussian War began. In early August, Napoleon III recalled his garrison from Rome and could no longer protect what remained of the Papal States. Widespread public demonstrations demanded that the Italian government take Rome. The Italian government took no direct action until the collapse of Napoleon at the battle of Sedan. King Victor Emmanuel II sent Count Ponza di San Martino to Pius IX with a personal letter offering a face-saving proposal that would have allowed the peaceful entry of the Italian Army into Rome, under the guise of protecting the pope.
According to Raffaele De Cesare:
The Pope’s reception of San Martino [10 September 1870] was unfriendly. Pius IX allowed violent outbursts to escape him. Throwing the King’s letter upon the table he exclaimed, "Fine loyalty! You are all a set of vipers, of whited sepulchres, and wanting in faith." He was perhaps alluding to other letters received from the King. After, growing calmer, he exclaimed: "I am no prophet, nor son of a prophet, but I tell you, you will never enter Rome!" San Martino was so mortified that he left the next day.
The Italian army, commanded by General Raffaele Cadorna, crossed the frontier on 11 September and advanced slowly toward Rome, hoping that an unopposed entry could be negotiated. The Italian army reached the Aurelian Walls on 19 September and placed Rome under a state of siege. Pius IX decided that the surrender of the city would be granted only after his troops had put up a token resistance, enough to make it plain that the take-over was not freely accepted. On 20 September, after a cannonade of three hours had breached the Aurelian Walls at Porta Pia, the Bersaglieri entered Rome (see capture of Rome). 49 Italian soldiers and 19 papal Zouaves died. Rome and the region of Lazio were annexed to the Kingdom of Italy after a plebiscite.
Again, according to Raffaele De Cesare:
The Roman question was the stone tied to Napoleon's feet — that dragged him into the abyss. He never forgot, even in August 1870, a month before Sedan, that he was a sovereign of a Catholic country, that he had been made emperor, and was supported by the votes of the conservatives and the influence of the clergy; and that it was his supreme duty not to abandon the pontiff. [...] For twenty years Napoleon III had been the true sovereign of Rome, where he had many friends and relations [...] Without him the temporal power would never have been reconstituted, nor, being reconstituted, would have endured.