What caused South Carolina to secede from the union?

The election of Lincoln as President.