July 7, 1846 - July 10, 1846
Along the California coastline, the commander of the Pacific Squadron, Commodore John Sloat, had received orders from Washington to seize Mexican harbors in the event of war. Upon learning that hostilities had broken out along the Rio Grande, Sloat captured Monterey on July 7, where he learned that Colonel John C. Frémont had already raised the flag of the California Republic at Sonoma. Sloat's marines seized the harbor at San Francisco (then known as Yerba Buena) three days later. His successor as commander of the Pacific Squadron, Commodore Robert F. Stockton, acting jointly with Frémont, declared California's annexation to the United States and organized a new territorial government, appointing himself governor.