Louis-Napoléon Bonaparte (born Charles-Louis Napoléon Bonaparte; 20 April 1808 – 9 January 1873) was the President of France from 1848 to 1852 and, as Napoleon III, the Emperor of the French from 1852 to 1870. He was the only president of the French Second Republic and the head of the Second French Empire. 

He was the nephew and heir of Napoleon I. He was the first Head of State of France to hold the title President, the first elected by a direct popular vote, and the youngest until the election of Emmanuel Macron in 2017. Barred by the Constitution and Parliament from running for a second term, he organized a "coup d'état" in 1851 and then took the throne as Napoleon III on 2 December 1852, the forty-eighth anniversary of his uncle's coronation. He remains the longest-serving French head of state since the French Revolution. His downfall was brought about by the Franco-Prussian war in which France was decisively defeated by the North German Confederation, led by Prussia. 

During the first years of the Empire, Napoleon's government imposed censorship and harsh repressive measures against his opponents. Some six thousand were imprisoned or sent to penal colonies until 1859. Thousands more went into voluntary exile abroad, including Victor Hugo. From 1862 onwards, he relaxed government censorship, and his regime came to be known as the "Liberal Empire". Many of his opponents returned to France and became members of the National Assembly.
When was Napoleon elected?
Louis-Napoléon Bonaparte (born Charles-Louis Napoléon Bonaparte; 20 April 1808 – 9 January 1873) was the President of France from 1848