Early 19th century Spain was influenced by the French Revolution and invaded by Napoleon Bonaparte's forces in 1807. This led to the Spanish Independence War against the French from 1808 to 1814. During this time two governments formed - the French government under King Joseph Bonaparte in Madrid and the Spanish government ruling from Cadiz under the Constitution of 1812. The Constitution established separation of powers but was later abolished by King Ferdinand VII when he returned to absolute monarchy in 1814.