A peace treaty ended the Mexican–American War in February 1848 and officially left California as new American territory.