Latin American countries gained independence from Spain and Portugal between 1807-1824 after the Napoleonic Wars weakened colonial control. While newly independent, the countries were unprepared for self-government. Reforms occurred throughout the 1820s-1840s as the countries sought to establish order and question religious and economic policies. Britain established trade relationships with many Latin American countries by the 1820s and its economic influence peaked in the late 1800s before declining in the early 1900s as U.S. investment grew.