In 1819, the Adams-Onís Treaty between the United States and Spain defined the Red River as the northern boundary of New Spain, officially placing the future location of Dallas well within Spanish territory. The area remained under Spanish rule until 1821, when Mexico declared independence from Spain, and the area was considered part of the Mexican state of Coahuila y Tejas. In 1836, Texians, with a majority of Anglo-American settlers, gained independence from Mexico and formed the Republic of Texas.