Pope Pius IX (Italian: Pio), born Giovanni Maria Mastai-Ferretti, was head of the Catholic Church from 16 June 1846 to his death on 7 February 1878. He was the longest-reigning elected pope in the history of the Catholic Church, serving for over 31 years. During his pontificate, Pius IX convened the First Vatican Council (1869–70), which decreed papal infallibility, but the council was cut short owing to the loss of the Papal States.
Europe, including the Italian peninsula, was in the midst of considerable political ferment when the bishop of Spoleto, Cardinal Giovanni Maria Mastai-Ferretti, was elected pope. He took the name Pius, after his generous patron and the long-suffering prisoner of Napoleon, Pius VII. He had been elected by the faction of cardinals sympathetic to the political liberalization coursing across Europe, and his initial governance of the Papal States gives evidence of his own moderate sympathies; under his direction various sorts of political prisoners in the Papal States were released. A series of terrorist acts sponsored by Italian liberals and nationalists, which included the assassination of (among others) his Minister of the Interior, Pellegrino Rossi, and which forced him briefly to flee Rome in 1848, along with widespread revolutions in Europe, led to his growing skepticism towards the liberal, nationalist agenda. Through the 1850s and 1860s, Italian nationalists made military gains against the Papal States, which culminated in the seizure of the city of Rome in 1870 and the dissolution of the Papal States. Thereafter, Pius IX refused to accept the Law of Guarantees from the Italian government, which would have made the Holy See dependent on legislation that the Italian parliament could modify at any time. Pius refused to leave Vatican City, and was thereafter referred to (chiefly by himself) as the "Prisoner of the Vatican".
His Church policies towards other countries, such as Russia, Germany or France, were not always successful, owing in part to changing secular institutions and internal developments within these countries. However, concordats were concluded with numerous states, such as Austria-Hungary, Portugal, Spain, Canada, Tuscany, Ecuador, Venezuela, Honduras, El Salvador and Haiti.