In 1055, the partially independent town of Fererra was given imperial powers, but was led by Matilda of Tuscany from 1101 and Frederick I, Holy Roman Emperor from 1158. Members of the House of Este took control of the city during the 13th century, and formed a university in Ferrara in 1391. Walls were built around the perimeter of Ferrara in the 15th and 16th centuries. It joined the Papal States in 1598. Its citadel was occupied by the Austrians in 1831 after the Italian United Provinces was formed, and the Austrians occupied the city in 1847. On 21 June 1859 the Austrians left the city of Ferrara and it was able to join the Kingdom of Italy.