Pope Pius IX was the longest serving of any pope. For 32 years he presided over the Catholic Church and the Papal States. In that time he decided to really muck things about.
He started slowly, by declaring in 1854 that the conception of Jesus was an immaculate one. Before then, Catholics could decide for themselves whether Mary was solely saintly or had sinned once or twice without being accused of heresy. From 1854, however, the Immaculate Conception became dogma and so anyone who disagreed with Pius’s interpretation was liable to execution or, if they were really unlucky, excommunication.
It seems pretty obvious that Pius didn’t like people objecting to his viewpoints. He disliked it so much that in 1869 Pius summoned the First Vatican Council, where it was decided that, actually, the Pope did know everything and that he was, in fact, completely infallible. This caused some consternation in the Church, even if only two bishops actually voted against the declaration. Outside the church, William Gladstone declared that the church had “forfeited their moral and mental freedom”.
By this time, the movement towards Italian unification was in full swing and the days of the Papal States were numbered. King Victor Emmanuel II offered Pius a face-saving compromise, proposing that his troops enter Rome under the guise of protecting the pope. To this offer, Pius replied: “You are all a set of vipers, of whited sepulchres, and wanting in faith.” Pius died in 1878. His position was infallible, but his body certainly wasn’t.