The Bourbon dynasty was restored in 1815, although this time with a constitution and elected legislature. When the king attempted to reassert elements of absolutism, a revolt led by the upper middle class placed Louis Philippe, the duc d'Orleans, on the throne in 1830. The electorate remained limited under the new monarchy, and disenfranchised groups rose up in 1848 to establish the Second Republic. Louis Napoleon Bonaparte, the former emperor's nephew, won election as president of the new republic later that year. He staged a coup as his single term in office drew to a close, and in 1852 a plebiscite confirmed him as Emperor Napoleon III. In the course of France's crushing defeat in the Franco-Prussian War (1870–71), the emperor was deposed and a Third Republic was proclaimed. A leftist Paris Commune—in the tradition of the radical Paris Commune that arose following the 1789 Revolution—was organized to oppose both the Prussians and the relatively conservative new regime, but it was defeated by government forces in 1871. The Third Republic went on to become the longest-lasting constitutional system in France's history. While monarchist elements continued to play an influential role in national affairs for many years, the economic, social, and political transformation wrought by the Revolution and its aftermath grew increasingly entrenched.