James K. Polk was elected president in 1845 on a platform of expanding American territory to the Pacific Ocean. To achieve this, he oversaw the Mexican Cession which saw the U.S. purchase the territories of Alta California and New Mexico from Mexico for $18 million in 1846. However, tensions rose and the Mexican-American War broke out later that year, ending in 1848 with the Treaty of Guadalupe Hidalgo that ceded additional Mexican lands including California, Nevada, Utah, and parts of other western states to the U.S.