Despite having shunned honours, on the evening of 16 June 1846 Mastai found himself burdened with the greatest of them: he was elected Pope and took the name Pius IX.
He had a difficult pontificate, but precisely because of that he was a great Pope, certainly one of the greatest. Thoroughly aware of being the "Vicar of Christ" and responsible for the rights of God and of the Church, he was clear, simple consistent. He combined firmness and understanding, fidelity and openness.
He began with an act of generosity and Christian sensitivity: amnesty for political crimes. His first Encyclical was a programmatic vision, but anticipated the "Syllabus": in it he condemned secret societies, freemasonry and communism. In 1847 he promulgated a decree granting extensive freedom of the press and instituted a civil guard, the municipal and communal council, the Council of State and the Council of Ministers. From then on his interventions as Father of all nations and temporal Prince continued unabated.
The question of Italian independence, which he sympathized with, did not set the Prince against the Pope, a fact that alienated the most intransigent liberals. The situation came to a head on 15 November when Pellegrino Rossi, the head of government, was killed and Pius IX had to take refuge in Gaeta.