In 1031 it became the capital of a small Moorish kingdom, and, though temporarily held by the Portuguese in 1168, it retained its independence until 1229, when it was captured by Alphonso IX.
Italy seemed to lie prostrate before the emperor, who commanded her for the first time from the south as well as from the north, In 1227 Frederick, who h1d promised to lead a crusade, was excommunicated by Gregory IX.
The measure was an amalgam of Cavours scheme for a free church in a free state, of Ricasolis Free Church Bill, rejected by parliament four years previously, and of the proposals presented to Pius IX.
Danger of foreign interference in the relations between Italy and the papacy had never been so great since the Italian occupation of Rome, as when, in the summer of 1881,the disorders during the transfer of the remains of Pius IX.
The duchy afterwards changed hands several times, one of its holders being Charles of Valois, natural son of Charles IX.