After the War of the Spanish Succession in the early 18th century, possession of the kingdom again changed hands. Under the terms of the Treaty of Rastatt in 1714, Naples was given to Charles VI, the Holy Roman Emperor. He also gained control of Sicily in 1720, but Austrian rule did not last long. Both Naples and Sicily were conquered by a Spanish army during the War of the Polish Succession in 1734, and Charles, Duke of Parma, a younger son of King Philip V of Spain was installed as King of Naples and Sicily from 1735. When Charles inherited the Spanish throne from his older half-brother in 1759, he left Naples and Sicily to his younger son, Ferdinand IV. Despite the two Kingdoms being in a personal union under the Habsburg and Bourbon dynasts, they remained constitutionally separate. Being a member of the House of Bourbon, Ferdinand IV was a natural opponent of the French Revolution and Napoleon. In 1798, he briefly occupied Rome, but was expelled from it by French Revolutionary forces within the year. Soon afterwards Ferdinand fled to Sicily. In January 1799 the French armies installed a Parthenopaean Republic, but this proved short-lived, and a peasant counter-revolution inspired by the clergy allowed Ferdinand to return to his capital. However, in 1801 Ferdinand was compelled to make important concessions to the French by the Treaty of Florence, which reinforced France's position as the dominant power in mainland Italy.. Which was signed first, the Treaty of Florence or the Treaty of Rastatt?