Soon after returning to Brazil, Pedro II was faced with an unexpected crisis. The Brazilian clergy had long been understaffed, undisciplined and poorly educated, leading to a great loss of respect for the Catholic Church. The imperial government had embarked upon a program of reform to address these deficiencies. As Catholicism was the state religion, the government exercised a great deal of control over Church affairs, paying clerical salaries, appointing parish priests, nominating bishops, ratifying papal bulls and overseeing seminaries. In pursuing reform, the government selected bishops who satisfied its criteria for education, support for reform and moral fitness. However, as more capable men began to fill the clerical ranks, resentment of government control over the Church increased.