Before the first Portuguese explorers, led by Pedro Álvares Cabral, arrived in 1500, Brazil is thought to have been inhabited by semi-nomadic populations for at least 10,000 years. Over the next three centuries, it was resettled by the Portuguese and exploited mainly for brazilwood (Pau-Brasil), then sugarcane (Cana-de-Açúcar), coffee beans and gold mining. The colony's manpower was initially composed of enslaved peoples, firstly Amerindians and then, after 1532, mainly Africans.
The only recorded transcontinental relocation of a royal family occurred in 1808 when the Portuguese royal family, headed by Queen Maria I of Portugal and her son and regent, the future João VI of Portugal, fled Napoleon's armies and relocated to Rio de Janeiro, along with the government and nobility. Although they returned in 1821, the interlude led to the opening of commercial ports to the United Kingdom — at the time isolated from most European ports by Napoleon — and to the elevation of Brazil to the status of a United Kingdom under the Portuguese Crown. Upon João VI's departure, the remaining royal government in Rio moved to dissolve the Kingdom of Brazil and return it to the status of colony. This resulted in the small scale conflicts known as the Brazilian War of Independence. On 7 September 1822 Prince regent Dom Pedro I (later Pedro IV of Portugal) declared independence, establishing the independent Empire of Brazil. A treaty recognizing the Empire's independence was signed on 29 August 1825 with Britain and Portugal. As the crown remained in the hands of the House of Bragança, this was more the severance of the Portuguese empire in two, than an independence movement as seen elsewhere in the Americas. Emperor Dom Pedro II of Brazil, 1873. Emperor Dom Pedro II of Brazil, 1873.
The Brazilian Empire was formally a democracy in the British style, although in practice, the emperor-premier-parliament balance of power more closely resembled the autocratic Austrian Empire. Slavery was abolished in 1888, through the "Golden Law", created by Princess Isabel, and intensive European immigration created the basis for industrialization. Pedro I was succeeded by his son, Pedro II — who in old age was caught by a political dispute between the Army and the Cabinet, a crisis arising from the Paraguay War. Pedro II was deposed from the throne on 15 November 1889, when a federal republic (officially, the Republic of the United States of Brazil) was established by Field Marshal Deodoro da Fonseca.
In the late nineteenth and early twentieth centuries, Brazil attracted over 5 million European, Arab and Japanese immigrants. During this time Brazil became industrialised, further colonised, and its interior further explored and developed. Brazilian democracy was replaced by dictatorships three times — 1930–1934 and 1937–1945 under Getúlio Vargas, and 1964–1985, under a succession of generals appointed by the military. Since 1985, Brazil has been regarded as a presidential democracy, a status affirmed by a plebiscite in 1993 which asked voters to indicate a preference for a presidential or parliamentary system. Voters also decided not to restore the country's constitutional monarchy.