The office of mayor has a local nature and must not be confused with the President of the Community of Madrid, the leader of the regional government.
Initially Mayors of Madrid had the office of 'Corregidor' when first instituted in the Kingdom of Castile by Henry III in 1393 and later formalized by the Catholic Monarchs–Ferdinand II and Isabella I–in 1480.
[4] In 1746 Ferdinand VI of Spain abolished the office, appointing a political and military governor in place, but the following year reversed this reform.
With 1833 territorial division of Spain the office of Corregidor was replaced by the office of Mayor, has continued to the present except for two periods: during the dictatorship of Primo de Rivera (1920-1930) and after the Second Spanish Republic, which suspended municipalities in Spain (1934-1936), when local governments a management committees created for this purpose.
[6] As in the regional or State governments, the mayor can be removed by a vote of no confidence approved by the majority of the plenary.