It is estimated that fewer than 80 Spanish settlers lived in the area before 1600, but later prosperity increased due to the use of indigenous and slave labor, and the Jesuit presence in the region. When nearby rivers were tapped as a source of irrigation in 1788 agricultural production increased. The extra revenues generated from this, and the ensuing additional trade with Buenos Aires, Viceroyalty on which it depended since its creation and transfer from the Captaincy General of Chile in 1776, no doubt led to the creation of the state of Cuyo in 1813 with José de San Martín as governor. It was from Mendoza that San Martín and other Argentinian and Chilean patriots organized the army with which they won the independence of Chile and Peru.