Pedro Alvares Cabral claimed Brazil for Portugal in 1500. The colony was ruled from Lisbon until 1808, when Dom Joao VI and the rest of the Portuguese royal family fled from Napoleon's army, and established its seat of government in Rio de Janeiro. Dom Joao VI returned to Portugal in 1821. His son declared Brazil's independence on September 7, 1822, and became emperor with the title of Dom Pedro I. His son, Dom Pedro II, ruled from 1831 to 1889, when a federal republic was established in a coup led by Deodoro da Fonseca, Marshal of the Army. Slavery had been abolished a year earlier by the Regent Princess Isabel while Dom Pedro II was in Europe. From 1889 to 1930, the government was a constitutional democracy, with the presidency alternating between the dominant states of Sao Paulo and Minas Gerais. This period ended with a military coup that placed Getulio Vargas, a civilian, in the presidency; Vargas remained as dictator until 1945. Between 1945 and 1961, Jose Linhares, Gaspar Dutra, Vargas himself, Café Filho, Carlos Luz, Nereu Ramos, Juscelino Kubitschek, and Janio Quadros were elected presidents. When Quadros resigned in 1961, Vice President Joao Goulart succeeded him. Goulart's years in office were marked by high inflation, economic stagnation, and the increasing influence of radical political elements. The armed forces, alarmed by these developments, staged a coup on March 31, 1964. The coup leaders chose as president Humberto Castello Branco, followed by Arthur da Costa e Silva (1967-69), Emilio Garrastazu Medici (1968-74), and Ernesto Geisel (1974-79), all of whom were senior army officers. Geisel began a democratic opening that was continued by his successor, Gen. Joao Baptista de Oliveira Figueiredo (1979-85). Figueiredo not only permitted the return of politicians exiled or banned from political activity during the 1960s and 1970s, but also allowed them to run for state and federal offices in 1982.