The party originated in New York after the state Democratic convention refused to endorse the Wilmot Proviso, a proposed law that would have banned slavery in any territory acquired from Mexico in the Mexican–American War. A faction of New York Democrats known as the Barnburners objected to slavery in the territories and opposed the 1848 Democratic nominee Lewis Cass. The Barnburners and other anti-slavery Democrats joined with some anti-slavery Whigs and the Liberty Party to form the Free Soil Party.