Popes in their secular role ruled portions of the Italian peninsula for more than a thousand years until the mid 19th century , when many of the Papal States were seized by the newly united Kingdom of Italy .