Spain in the 1810s was a country in turmoil. Occupied by Napoleon from 1808 to 1814, a massively destructive "war of independence" ensued, driven by an emergent Spanish nationalism. Already in 1810, the Caracas and Buenos Aires juntas declared their independence from the Bonapartist government in Spain and sent ambassadors to the United Kingdom. The British blockade against Spain had also moved most of the Latin American colonies out of the Spanish economic sphere and into the British sphere, with whom extensive trade relations were developed. The remaining Spanish colonies had operated with virtual independence from Madrid after their pronouncement against Joseph Bonaparte.