The modern history of Los Angeles begins in 1847, when the U.S. military first occupied the city following the Battle of Rio San Gabriel and the Treaty of Cahuenga ended the conquest of California resulting in a ceasefire between . About a year later, in early 1848, the Treaty of Guadalupe Hidalgo officially ended the Mexican-American War and Mexico formally ceded California to the United States. Soon after that, the discovery of gold in California brought a flood of hundreds of thousands of people to California and a demand of beef from Los Angeles ranchos, boosting the economy and population of Los Angeles.