Pius IX convened the First Vatican Council in December 1869, the first general council of the church in over three hundred years, gathering more than seven hundred bishops from across the world. Its central and most contested achievement was the dogmatic constitution Pastor Aeternus, defining that the pope, when speaking ex cathedra on a matter of faith or morals in his capacity as shepherd of the whole church, possesses the infallibility Christ willed his church to enjoy, a definition passed after real debate and open opposition from a minority of bishops who feared it overstated papal authority against that of bishops and councils.
The council never finished its planned agenda. In July 1870, the Kingdom of Italy, which had already absorbed most of the former Papal States over the preceding decade, took advantage of France's withdrawal of its protective garrison during the Franco-Prussian War to send troops into Rome itself. After a brief token resistance, the city fell in September 1870, and Pius IX suspended the council indefinitely rather than close it, a suspension that in practice lasted almost ninety years until the Second Vatican Council reopened the conversation the First had left unfinished.
Pius IX responded to the loss of Rome by refusing to recognize Italian sovereignty over the city or to leave the Vatican grounds, declaring himself a prisoner of the Vatican, a self-imposed confinement his three immediate successors maintained, and which was not resolved until the Lateran Treaty of 1929 created the independent Vatican City state under a later pope. Pius IX himself never saw the standoff end, dying in 1878 still formally unreconciled with the kingdom that had taken his temporal domain.