Peru was declared an independent nation by Jose de San Martin in 1821, and in 1824 Simon Bolivar put an end to the War of Independence. However, despite efforts to organize the young Peruvian republic, in the nineteenth century the country had to face up to the cost of the struggle: a tough economic crisis and a tradition of military strongmen who gave civilians little chance to govern.
By 1860, thanks to income from guano, cotton and sugar , Peru was able to do without enforced labor imposed on the indigenous population and African slaves alike. Chinese and European immigrants swelled the workforce and integrated with Peru's society. The country was linked up by a railway network, and during the mandate of President Manuel Pardo, Peru organized its first civilian government . The first Japanese immigrants were to arrive at the end of the nineteenth century.
But in 1879 , the country found itself at war with Chile . Peru was defeated and left bankrupt. After another spell of military regimes, Peru returned to civilian rule, giving rise to a time called "the Aristocratic Republic" . The economy was dominated by the land-owning elite, and an export-oriented model imposed. The success of the rubber boom lent fresh splendor to the myth of El Dorado.