The catalyst for the Mexican-American War was the U.S. annexation of Texas on 29 December 1845. When Mexico responded by ending diplomatic relations with the U.S. government, President James K. Polk asked Congress to declare war on Mexico. Polk took advantage of the animosity between the two nations to advance a political agenda focused on Manifest Destiny (the belief that the U.S. was preordained to expand across the American continent to the Pacific Ocean), and he perceived a war with Mexico as an opportunity to further annex Mexican territory to the United States. Despite the general unpopularity of the impending war, Congress approved Polk’s declaration on 13 May 1846.
Navy involvement in the Mexican-American War included blockades and operations on the Pacific coast and Gulf of Mexico. The Pacific Squadron, under the command of Commodore John Sloat and Commodore Robert Stockton, ensured success in the California campaign and the Navy claimed Monterey, San Francisco, and San Diego for the U.S. From the Gulf of Mexico, Commodore Matthew Perry traversed through the small rivers and waterways of Mexico to capture enemy strongholds and block supply routes. With Commodore David Conner, Perry also coordinated U.S. land and naval forces with Army General Winfield Scott to land over 22,000 American troops in Vera Cruz in March 1847. This would be the largest U.S. amphibious operation until the Gallipoli campaign in World War I. Because of the involvement of the Navy and coordination of effort with General Scott, U.S. troops had taken Mexico City within a few months of the Vera Cruz landings. The war ended on 2 February 1848 with the Treaty of Guadalupe Hidalgo, in which Mexico agreed to extend the southern border of Texas to the Rio Grande River, and ceded present-day California, New Mexico, Utah, and Nevada, as well as parts of Oklahoma, Kansas, and Wyoming, to the United States.