The Peninsular War was a military conflict for control of the Iberian Peninsula during the Napoleonic Wars, waged between France and the allied powers of Spain, the United Kingdom and Portugal. It started when French and Spanish armies, then allied, occupied Portugal in 1807, and escalated in 1808 when France turned on Spain, its former ally. The war on the peninsula lasted until the Sixth Coalition defeated Napoleon in 1814, and is regarded as one of the first wars of national liberation, and significant for the emergence of large-scale guerrilla warfare. British and Portuguese forces eventually secured Portugal, using it as a safe position from which to launch campaigns against the French army, while both Spanish and Portuguese guerrillas weakened the occupying forces.