crisis of papal authority in the following century, Terracina came to be ruled by local or Roman families (like that of Crescenzi, who built a massive castle, or the Frangipani, who occupied it from 1153 to 1202). In 1088 it was the seat of the first conclave held outside Rome. In the 11th and 12th centuries Terracina had a notable spurt of growth, and two new suburbs were built next to the two walled gates of Porta Maggio ("Cipollata"), Porta Albina, Porta St. Gregory and Porta Romana. A free commune was also instituted. In 1217 Pope Honorius III united its diocese to those of Sezze and Priverno. The 1357 Costituzioni Egiziane ("Egyptian Constitutions") marked the beginning of a stronger papal authority, which however did not impede the growth of the king of Naples's influence, nor did it stop the city's internal struggles. Modern era The 16th century saw the communal freedoms steadily eroded, due both to the general decline of Terracina (aggravated by malaria in the increasingly marshy surrounding land) and the devastating attacks by pirates coming from North Africa. A malaria plague in 1520 contributed to this process. However, in this period the first Renaissance mansions began to be built by noble families like the Savio, Garzoni, Gottifredi, de' Romanis and others. In the 17th century the popes began a program of repopulation of Terracina through the resettlement of families from the country nearby lured by tax exemptions. In this period the churches of St. John (formerly St. Lawrence) and Madonna delle Grazie were both rebuilt. In the two following centuries Terracina assumed its current appearance. Pope Pius VI started a program of draining the marshes and added a new quarter next to the channel-port. During the Napoleonic occupation Terracina was at first annexed to the Circeo département, but revolted in 1798: the riot was suppressed by French and Polish troops, led by general Étienne-Jacques-Joseph-Alexandre MacDonald. After the end of the Napoleonic Wars, the position of Terracina at the border between the Papal States and the Kingdom of Naples was officially set by the Concordat signed by Pope Pius VII and Ferdinand I of Two Sicilies in 1818. In 1839 and 1843 Gregory XVI visited the city, in which he instituted works for a new port. In 1934 the city was removed from the province of Rome and added to that of Latina. After the end of World War