The immediate trigger of the conflict was Napoleon's invasion of the Iberian Peninsula (Spain and Portugal) in 1807 and 1808, but its roots also lay in the growing discontent of creole elites (people of Spanish ancestry who had been born in Latin America) with the restrictions imposed by Spanish imperial rule.