They were won in the Mexican-American war, alongside Texas. Texas gained recognition as a state of the United States while California and New Mexico became new states to be added to the Union as a result of the secession from the Mexican country. They were a result of the US wanting to go westward.