<P> After the war of independence Ferdinand VII returned to the throne (1814), but after a liberal military revolution, Colonel Riego made the king swear to respect the Constitution . Liberal and conservative government thereafter alternated, ending with the enthronement of Isabella II (1830--1904). She could not calm down the political tension that would lead to yet another revolt, the First Spanish Republic, and the comeback of the monarchs, and eventually to the Second Spanish Republic and the Spanish Civil War . </P> <P> The military uprising of July 1936 was defeated in Madrid by a combination of loyal police units and workers' militias . After this, from 1936--1939, Madrid was held by forces loyal to the Spanish Republic and was besieged by Spanish Nationalist and allied troops under Francisco Franco . Madrid, besieged from October 1936, saw a pitched battle in its western suburbs in November of that year and eventually fell to the nationalists on 28 March 1939 . The Siege of Madrid saw the first mass bombing of civilians from the air by the German Condor Legion . </P> <P> During the dictatorship of Francisco Franco, especially after the sixties, the south of Madrid became very industrialized and experienced massive migrations from rural environments into the city . Madrid's south - eastern periphery became an extensive slum settlement, which was the base for an active cultural and political life . </P> <P> Following the death of Franco, and in order to secure stability and democracy, the emerging democratic parties (including those of left - wing and republican ideology) accepted Franco's wish to be succeeded by Juan Carlos I, leading to Spain's current position as a constitutional monarchy . </P>

When was madrid established as the capital of spain