On 2 July 1621, Emperor Ferdinand II elevated the County of Guastalla to the rank of a duchy. Ferrante II Gonzaga became the first duke of the city, hoping to succeed in the future to the great Duchy of Mantua. Ferrante II died of plague in 1630 and was succeeded by his son, Cesare II. With him, Guastalla expanded its territory with the annexation of the lands of Dosolo, Luzzara and Reggiolo, until then owned by Mantua. In 1632, his son Ferrante III ascended to the throne. Having no male heir, he bequeathed the Duchy of Guastalla to his daughter's husband Ferdinand Charles, Duke of Mantua. Meanwhile, Guastalla modernized its defenses, owing to the frequent wars which swept over Italy at this time. Between 1689 and 1690, the city was attacked by the Spaniards, who managed to demolish the defensive walls, thus occupying the city, and destroyed the Visconti castle and the town tower. In 1692, the Duke of Guastalla was accused of felony, and Emperor Leopold I gave Guastalla and its territories to Vincenzo Gonzaga. During his reign, in 1702, there were violent clashes in the territory of Luzzara between the French troops of Louis XIV and imperial forces led by Prince Eugene of Savoy. Shortly afterward, Guastalla was itself attacked. The city, although putting up a heroic defense, was forced to surrender. In 1714, Antonio Ferdinando Gonzaga inherited the duchy on the death of his father, but did not take an active role in politics. He died in 1729, having been severely burned in an accident. His brother Giuseppe Gonzaga, the last duke of the city, took power in 1734 and saw the occupation by the Austrians in the so-called Battle of Guastalla. Later, the city was sold to Charles Emmanuel III of Savoy until 1738. Giuseppe Gonzaga died without heirs in 1746, and the Duchy of Guastalla was incorporated into Austrian Lombardy under the government of Maria Theresa of Austria in 1747. With the Treaty of Aix-la-Chapelle, Guastalla was joined to the Duchy of Parma, ruled by the Spanish Bourbons. It was annexed to the Cisalpine Republic in 1802 but became an autonomous duchy in 1806. It was returned in 1815 to the Duchy of Parma, and it remained until 1847 under Parma's rule. With the death in 1847 of Marie Louise, Duchess of Parma, the duchy then passed to the Duchy of Modena and later on to the unified Kingdom of Italy.
Territory
The Gonzaga family, at the maximum extent of the Guastalla duchy, also took control of the principality of Bozzolo and the annexed territories, and the Duchy of Sabbioneta.