On May 6, 1808, Napoleon forced the King of Spain, Ferdinand VII, to abdicate.
Napoleon then installed his reluctant brother, Joseph Bonaparte, as the new King of Spain.
Spanish America questioned if it should remain loyal to the Spanish throne with the French brother of Napoleon on it.
Pope Pius VII excommunicated Napoleon on June 10, 1809, resulting in Napoleon’s men kidnapping him. He was scurried out of Rome at night and confined for six years in Savona, Italy.
This compounded the situation with New Spain, which was Catholic.