He was born Giovanni Maria Mastai-Ferretti in 1792 and took holy orders in 1819 and over the years gained a reputation as being more in-line or sympathetic to the liberal, nationalist trend across Italy. In 1846 he was elected to the See of Peter taking the name of Pius IX. Liberals cheered and conservatives groaned as the new pontiff spoke of "Italy" (which did not then exist), eased up the laws of his predecessors and opened the jails of Rome to free the liberals Gregory XVI had locked up. However, many were looking at him with rose-colored glasses and mistook his recognition of legitimate problems in the Italian states for revolutionary liberalism. They were to soon find out how wrong they were. When many Italians were clamoring for war against Austria Pius IX refused to endorse such an action on the grounds that he could never bless two groups of his own Catholic flock killing each other.
The liberals were quick to turn on the Pope and turn deadly in 1848. The following year Pius IX was forced to flee Rome where a republican government was declared and, from Gaeta, the Pontiff excommunicated the lot of them. The republic was an unpopular, dismal failure with most people refusing to vote in the elections and many of those who did wrote in the Pope's name! Pius IX was restored to his throne by French troops sent at the urging of Empress Eugenie. Once back the Pope moved his primary residence to the Vatican Palace and it made clear to the liberals that there would be no more 'mister nice guy'. He refused all concessions and in a display that his spiritual power remained regardless of his political position as the local monarch at the end of 1854 he proclaimed the doctrine of the Immaculate Conception, on his own authority. In 1864 he issued the famous to some, infamous to others "Syllabus of Errors" which refuted the collective errors of revolutionary liberalism. In 1869 he called the First Vatican Council which is most known for its full definition of papal infallibility.
It should also be remembered, along with all of this, Pius IX, the same man who once famously thundered, "The tradition? I AM the tradition!" was also a very friendly, forgiving and humorous man. When writing a paper about his role in the Risorgimento at university the one thing that surprised me most about Pius IX in reading all about his was how very funny he could be, often at his own expense. He was also always quick to forgive his enemies even if he had just previously condemned them in the strongest terms. The efforts of the liberals to usurp his monarchial position did not end. Campaigns had reduced his realm to the city of Rome itself, protected by the French and when war with Prussia broke out in 1870 these forces were withdrawn and the Italian nationalists were quick to pounce. Pius IX ordered only a symbolic fight be put up and as soon as the walls were breached he ordered his small army of international volunteers to surrender. Rome was occupied and Pius IX isolated himself, refusing to recognize the new government and was known thereafter as the "Prisoner of the Vatican".
However, while he had lost his temporal power (and many thought this would be the death of the Church) his reputation only increased around the world and the prestige of the Pope reached new heights it had never known before. There was something of a Catholic revival around the world during his reign despite the attacks the Church came under at almost every turn. Even in Italy he was widely respected by many who had opposed him and when King Victor Emanuel II was on his deathbed the Pope quickly lifted his excommunication of the monarch that had conquered his state, allowing him the last rites and a Catholic burial. The Pope himself died only about a month later in 1878 while saying his prayers. It is noteworthy that the man who came to the Throne of St Peter cheered by liberals went to his death, and is still to this day, considered one of the greatest enemies of the revolutionary cause and a great champion to conservative Catholic monarchists and many other monarchists in general.
*Addition: H.H. Pope John Paul II began the process for the canonization of Pope Pius IX and he was beaitified in 2000.