The Mexican-American War was one of the most complicated and divisive conflicts in US history. The causes of the war were varied and multifaceted. Texas, which had become an independent country in 1836, sought annexation with the United States. However, union with the United States was opposed by Mexico which claimed sovereignty over the territory. In addition, many Americans in the Northern states opposed the entry of Texas as a state because slavery was legal there and the annexation of the territory would mean slave states outnumbered those where slavery was illegal. Concurrently, many in the United States, including President James K. Polk, wanted to acquire more territory in the western portions of North America. These regions were controlled by Mexico.