During the Peninsular War, started in 1808, the "Xunta Suprema de Galicia" directed the war against the French invaders and maintained the public order in Galician territory. This "Xunta Suprema" was in charge of military, legislative issues, and international relations. It was the first time that the Xunta had real autonomy, as the Spanish control weakened. This situation lasted until the French invaders were eventually expelled from the Iberian Peninsula and Ferdinand VII of Spain gradually recovered control over former territories (1813–1814).