The Treaty of Fontainebleau between King Charles IV and Napoleon allowed French troops to be positioned in Spain, ostensibly to prepare for the invasion of Portugal, thereby reinforcing his presence in the country.
The Spanish people pressured King Charles IV to abdicate in favor of his son and rival, Ferdinand VII who was declared the legitimate monarch two days into the rebellion.
As the Spanish monarchy renounced the throne, Napoleon's brother Joseph Bonaparte was installed as the king of Spain for a brief reign characterized by the Bayonne Constitution.
Jorge Juan Guillelmi, acting as the Captain-General of Aragon, refused to arm an uprising of Zaragozans on May 24, 1808, despite the threat posed by the invading Napoleonic Army.
[6] Palafox was officially confirmed as the Captain-General of Aragon by the Cortes upon the Treaty of Valençay's withdrawal of French troops and restoration of King Ferdinand VII in 1813.