See the Mexican-American War, from Wikipedia:
The victory and territorial expansion Polk envisioned inspired patriotism among some sections of the United States, but the war and treaty drew fierce criticism for the casualties, monetary cost, and heavy-handedness. The question of how to treat the new acquisitions intensified the debate over slavery in the United States. Although the Wilmot Proviso that explicitly forbade the extension of slavery into conquered Mexican territory was not adopted by Congress, debates about it heightened sectional tensions. Some scholars see the Mexican–American War