query: When did Madrid become capital of Spain?
passage: History of Madrid
The documented history of Madrid dates to the 9th century, even though the area has been inhabited since the Stone Age. The development of Madrid as a city began when Philip II moved his court there from Toledo in the 1560s. Madrid has been the country's capital continuously since 1606.
passage: Siege of Madrid
The Siege of Madrid was a two and a half year siege of the Spanish capital city of Madrid, during the Spanish Civil War of 1936 to 1939. The city, besieged from October 1936, eventually fell to the Francoist armies on 28 March 1939. Madrid was held by various forces loyal to the Spanish Republic and was besieged and subject to aerial bombardment by the rebel faction under General Francisco Franco. The Battle of Madrid in November 1936 saw the most intense fighting in and around the city when the Nationalists made their most determined attempt to take the Republican capital.