The Spanish established a walled fortress, Presidio San Agustín del Tucsón, on August 20, 1775. Attacks were repeatedly mounted by Apaches. The town became a part of Mexico after independence from Spain in 1821.
Tucson was captured by the Mormon Battalion during the Mexican-American War. Following the Gadsden Purchase in 1853, Tucson became a part of the United States of America, although the American military did not formally take over control of the community until March 1856.