Because he was a protestant in a catholic country
So, in order to access to the throne, he had to convert to the catholics.
That's why the church officials were so important, the people wanted to be sure he became a true catholic
("Pais vaut bien une messe")