Relations with the Kingdom of Italy were difficult during the papacies of Pius IX and Leo XIII, who had to endure the status of prisoner of the Vatican after the capture of Rome.
It was only under Pius XI that the Lateran Treaty was signed, establishing the State of Vatican City, allowing for greater papal autonomy.