Before US President James K. Polk took office in 1845, the US Congress approved the annexation of Texas. Polk wished to gain control of a portion of Texas, which had declared independence from Mexico in 1836, but it was still claimed by Mexico. That paved the way for the outbreak of the Mexican–American War on April 24, 1846.