The peninsular war with France,which resulted from the napoleonic occupation of Spain, caused Spanish creoles in Spanish America to question their allegiance to Spain ,stoking independence movements that culminated in various Spanish American wars of independence.