The history of San Diego began in the present state of California, when Europeans first began inhabiting the San Diego Bay region. As the first area of California in which Europeans settled, San Diego has been described as "the birthplace of California". Explorer Juan Rodríguez Cabrillo was the first European to discover San Diego Bay in 1542, roughly 200 years before other Europeans settled the area. Native Americans such as the Kumeyaay people had been living in the area for as long as 12,000 years prior to any European presence. A fort and mission were established in 1769, which gradually expanded into a settlement under first Spanish and then Mexican rule.

San Diego officially became part of the U.S. in 1848, and the town was named the seat of San Diego County when California was granted statehood in 1850. It remained a very small town for several decades, but grew rapidly after 1880 due to development and the establishment of multiple military facilities. Growth was especially rapid during and immediately after World War II. Entrepreneurs and boosters laid the basis for an economy based today on the military, defense industries, biotech, tourism, international trade, and manufacturing. San Diego is now the eighth largest city in the country and forms the heart of the larger San Diego metropolitan area.

Kumeyaay and Colonial Spanish period (prehistory–1821)

Pre-European contact

San Dieguito complex (~12000 BCE - 8000 BCE) The first inhabitants of the region are those of the San Dieguito complex. Hunter-gatherers who used scrappers, choppers, and knives. The people of the San Dieguito complex are considered Paleo-Indians.

La Jolla complex (~8000 BCE – 1000 CE) The next inhabitants of the region were the people of the La Jolla complex, also known as the Shell Midden people, who lived in the region between 8000 BCE and 1000 CE.

Kumeyaay period (1000 CE – 1770s)

Yuman groups began migrating from the east and settling the area, who became known as the Kumeyaay. The Kumeyaay scattered villages across the region, including the village of Cosoy (Kosa'aay) which was the Kumeyaay village that the future settlement of San Diego would stem from in today's Old Town. Other villages include Nipaquay (Mission Valley), Choyas (Barrio Logan), Utay (Otay Mesa), Jamo (Pacific Beach), Onap (San Clemente Canyon), Ystagua (Sorrento Valley), and Melijo (Tijuana River Valley).

The Kumeyaay, in what is known as San Diego, spoke two different dialects of the Kumeyaay language. North of the San Diego River, the Kumeyaay spoke the Ipai dialect, which included the villages of Nipaquay, Jamo, Onap, Ystagua, and Ahmukatlatl. South of the San Diego river, the Kumeyaay spoke the Tiipai dialect, which was spoken in the villages of Kosa'aay, Choyas, Utay, and Melijo.

Spanish exploration and colonial period

The first European to visit the region was Juan Rodríguez Cabrillo in 1542. His landing is re-enacted every year at the Cabrillo Festival sponsored by Cabrillo National Monument, but it did not lead to settlement.

The bay and the area of present-day San Diego were given their current name sixty years later by Sebastián Vizcaíno when he was mapping the coastline of Alta California for Spain in 1602.Journal of San Diego History, October 1967 Vizcaino was a merchant who hoped to establish prosperous colonies. After holding the first Catholic mass conducted on California soil on the feast day of San Diego de Alcala, (also the patron saint of his flagship), he renamed the bay. He left after 10 days and was enthusiastic about its safe harbor, friendly natives, and promising potential as a successful colony. Despite his enthusiasm, the Spanish were unconvinced; it would be another 167 years before colonization began.Baker, Gayle San Diego, Another HarborTown History ISBN (print) 0-978-0-9710984-6-6 (e-book) 978-0-9879038-5-3

In 1769, Gaspar de Portolà and his expedition founded the Presidio of San Diego (military post) above the village of Cosoy, and on July 16, Franciscan friars Junípero Serra, Juan Viscaino and Fernando Parron raised and 'blessed a cross', establishing the first mission in upper Las Californias, Mission San Diego de Alcala.Leffingwell, Randy (2005), California Missions and Presidios: The History & Beauty of the Spanish Missions. Voyageur Press, Inc., Stillwater, MN. , p. 17 Colonists began arriving in 1774. In the following year the Kumeyaay indigenous people rebelled against the Spanish, which resulted in the deaths of a priest and two others, and burned the mission.Ruscin, Terry (1999), Mission Memoirs, Sunbelt Publications, San Diego, CA. , p. 11 Serra organized the rebuilding, and a fire-proof adobe and tile-roofed structure was completed in 1780. By 1797 the mission had become the largest in California, with a population of more than 1,400 converted Native American "Mission Indians" relocated to and associated with it. The tile-roofed adobe structure was destroyed by an 1803 earthquake but replaced by a third church in 1813.Hogle, Gene NAC Green Book of Pacific Coast Touring (1931) National Automobile Club p.39

In 1804, the Province of Las Californias split between the provinces of Alta California and Baja California, with San Diego being governed by Alta California from the regional capital in Monterey.

Mexican period (1821–1848)

First Mexican Empire and First Mexican Republic (1821–1835): Pueblo de San Diego In 1821, Mexico ousted the Spanish in the Mexican War of Independence and created the Province of Alta California. The San Diego Mission was secularized and shut down in 1834 and the land was sold off. 432 residents petitioned the governor to form a pueblo, and Juan María Osuna was elected the first alcalde ("municipal magistrate"), defeating Pío Pico in the vote. Beyond town Mexican land grants expanded the number of California ranchos that modestly added to the local economy.

The original town of San Diego, Pueblo de San Diego, was located at the foot of Presidio Hill, in the area which is now Old Town San Diego State Historic Park. The location was not ideal, being several miles away from navigable water. Imported goods and exports (primarily tallow and hides) had to be carried over the La Playa Trail to the anchorages in Point Loma.Historic La Playa Trail Association website This arrangement was suitable only for a very small town. In 1830 the population was about 600. In 1834 the presidio was described as "in a most ruinous state, apart from one side, in which the commandant lived, with his family. There were only two guns, one of which was spiked, and the other had no carriage. Twelve half-clothed and half-starved-looking fellows composed the garrison, and they, it was said, had not a musket apiece." The settlement composed about forty brown huts and three or four larger, whitewashed ones belonging to the gentry.Richard Henry Dana. Two years before the mast. First published 1840. Page 115 of the first Penguin edition, first published in Penguin 1948.

Centralist Republic of Mexico (1835–1846): Decline of San Diego In 1836, the Alta California and Baja California territories merged as the Department of Las Californias as part of the reforms made under Las Siete Leyes formalized under then President Antonio López de Santa Anna.

Kumeyaay raids on San Diego In 1838 the town lost its pueblo status because of its dwindling population, estimated as 100 to 150 residents, and became a sub-prefecture of the Pueblo de Los Ángeles. This was due to souring relations between the Mexican regime and the Kumeyaay, which threatened the stability and the security of the town. Between 1836 and 1842, ranchos were abandoned as the Kumeyaay pillaged the countryside, with an initial attack on El Cajon in 1836 and Tijuana falling into Kumeyaay hands in 1839.

San Diego was first attacked circa 1836–1837 when a Mexican expedition to rescue two hostages failed and a large force of Kumeyaay launched an attack on the town, but were caught off guard when an armed merchant vessel, Alert, docked on the bay fired upon the Kumeyaay warriors forcing the Kumeyaay to retreat. Sir Edward Belcher of the British Navy on board HMS Sulphur on its way to fight in the First Opium War in Qing China, docked in San Diego Bay in October 1839, and noted that it would appear that San Diego would soon be taken by the "Indians" or another nation.

In June 1842, it culminated in a Kumeyaay raid on San Diego in an attempt to expel the Mexican settlers, after doing so to the Californios in the surrounding rancho countryside. While the pueblo was able to defend against the attack, the Kumeyaay managed to control much of the south, east, and most of the north of the settlement, with the town becoming dependent on sea access to maintain connections to the rest of Mexico. Joining with the existing Quechan resistance in the east, the Kumeyaay and the Quechan cut off Alta California from all land routes to the rest of the Mexican republic between the Colorado River and the Pacific Ocean (around the modern US-Mexican border) up until the Mexican-American War, further threatening Mexican control of the southern Alta California coast.Connolly, Mike. "Kumeyaay - The Mexican Period". www.kumeyaay.com. Retrieved 2020-10-16. For a period of time, the Mexicans became refugees on Point Loma as they waited for ships, hoping to evacuate from San Diego. San Diego was reinforced by forces under Manuel Micheltorena, consisting of soldiers and convicts.

Mexican–American War (1846-1848)

Captures of San Diego During the Mexican–American War, the city of San Diego changed hands multiple times in 1846. Initially, American forces, including the USS Cyane and the California Battalion, captured the city in late July, raising the American flag over the pueblo. Many local Mexicans were divided as many of them welcomed the American occupation due to their disapproval of the Mexican administration of Alta California. José Antonio Estudillo retired to El Cajon, and declared himself neutral during the war.

The situation shifted after a revolt in Los Angeles on September 27, 1846. In early October, Serbulo Varela, with a contingent of fifty men (originally led by Francisco Rico (who was recalled back to Los Angeles)), approached San Diego to reclaim it. The small American garrison, under Captains Ezekiel Merritt and John Bidwell, evacuated the town, fearing they would be overrun. The Americans and their allies boarded the whaling ship Stonington. Some local residents declared neutrality. The Californios regained control without conflict.

On October 24, 1846, American forces returned to recapture San Diego. An American soldier spiked the Mexican cannons on Presidio Hill, allowing American volunteers to retake the city after a brief skirmish. The Mexican flag was lowered, but María Antonia Machado famously prevented it from being desecrated. American forces faced a siege beginning October 26, when Captain Leonardo Cota and Ramón Carrillo arrived with 100 men. The Americans, reinforced by Commodore Stockton's troops and the USS Congress, retook San Diego in Early November. The Stonington then departed to Ensenada dropping off a force led by Captain Samuel Gibson, who returned overland with supplies.

The Californios, led by figures such as José Antonio Carrillo, harassed the American positions, even attempting to starve them out by controlling local resources and blocking supply routes. Fighting occurred in late November driving California forces off of Presidio hill, renaming the presidio Fort Stockton. According to Californio accounts, the situation in San Diego was tense. The besieged Americans constructed defenses and enduring nightly sniper fire. Despite efforts to secure provisions, including a failed attempt to capture cattle, the Americans remained largely trapped. The siege continued until early December, when news of General Stephen Kearney’s approaching dragoons led to a coordinated effort to relieve the town.