On March 2 1836, Texas declared its independence from Mexico. It started years before when settlers came to Texas based on an agreement between Moses Austin and the new Mexican government. For about 10 years, Texas was an independent republic. Sam Houston was Texas’ first elected president. In 1845, Texas joined the Union as the 28th state, leading to the outbreak of the Mexican-American War.