When Ferdinand VII assumed the throne of Spain in 1813, Valero became critical of the new king's policies towards the Spanish colonies in Latin America. He developed a keen hatred of the monarchy, resigned his commission in the army, and headed for Mexico. There he joined the insurgent army headed by Agustín de Iturbide, in which Valero was named chief of staff. He fought for and helped achieve Mexico's independence from Spain. After the Mexican victory, Iturbide proclaimed himself Emperor of Mexico. Since Valero had developed anti-monarchist feelings following his experiences in Spain, he revolted against Iturbide. His revolt failed and he attempted to escape from Mexico by way of sea.