Carlos IV became King of Spain in the late 18th century. During his reign, Napoleon occupied Spain and forced Carlos IV and his son Fernando VII to abdicate in Bayonne in 1808. Napoleon then installed his brother Joseph Bonaparte as the new King of Spain. This led to the Spanish War of Independence as the Spanish people rebelled against French rule. The Central Council was formed in Cadiz in 1810 to coordinate the resistance and eventually established the Constitution of 1812, one of the most progressive in Europe at the time, establishing principles of popular sovereignty, separation of powers, and equal rights.