Portuguese arrived in Brazil in 1500. They found a local Indian population. They first began trading with the Indians and then subdued them. The Portuguese and other Europeans started growing sugar in Brazil. The Portuguese gained full control over the early part of the 17th century. In 1822 Brazil became independent, with Don Pedro as the emperor. In 1865 Brazil became involved in a bloody five-year war with Paraguay. In 1888 slavery was abolished and the next year the emperor was overthrown by the military. 1889-1930 was the period of the "old Republic". It was overthrown by the military in 1930. From 1945 until 1964 the Second Republic was in power. Democracy was reinstituted in 1985.