capturing the major ports including San Diego, but the Californios in southern Alta California struck back. Following the successful revolt in Los Angeles, the American garrison at San Diego was driven out without firing a shot in early October 1846. Mexican partisans held San Diego for three weeks until October 24, 1846, when the Americans recaptured it. For the next several months the Americans were blockaded inside the pueblo. Skirmishes occurred daily and snipers shot into the town every night. The Californios drove cattle away from the pueblo hoping to starve the Americans and their Californio supporters out. On December 1, the American garrison learned that the dragoons of General Stephen W. Kearney were at Warner's Ranch. Commodore Robert F. Stockton sent a mounted force of fifty under Captain Archibald Gillespie to march north to meet him. Their joint command of 150 men, returning to San Diego, encountered about 93 Californios under Andrés Pico. In the ensuing Battle of San Pasqual, fought in the San Pasqual Valley which is now part of the city of San Diego, the Americans suffered their worst losses in the campaign. Subsequently, a column led by Lieutenant Gray arrived from San Diego, rescuing Kearny's battered and blockaded command. Stockton and Kearny went on to recover Los Angeles and force the capitulation of Alta California with the "Treaty of Cahuenga" on January 13, 1847. As a result of the Mexican–American War of 1846–48, the territory of Alta California, including San Diego, was ceded to the United States by Mexico, under the terms of the Treaty of Guadalupe Hidalgo in 1848. The Mexican negotiators of that treaty tried to retain San Diego as part of Mexico, but the Americans insisted that San Diego was "for every commercial purpose of nearly equal importance to us with that of San Francisco," and the Mexican–American border was eventually established to be one league south of the southernmost point of San Diego Bay, so as to include the entire bay within the United States. American period The state of California was admitted to the United States in 1850. That same year San Diego was designated the seat of the newly established County of San Diego and was incorporated as a city. Joshua H. Bean, the last alcalde of San Diego, was elected the first mayor. Two years later the city was bankrupt; the California legislature revoked the city's charter and placed