Most of the future western United States, roughly south of 42 degrees North latitude and from California eastward to Texas, the Oklahoma Panhandle and southwestern Kansas, was part of the Viceroyalty of New Spain and, thus, became part of Mexico upon independence from Spain in 1821.