only five weeks after abraham lincoln was elected the sixteenth president , eleven slave states seceded to form the confederate states of america in 1861 , igniting a bloody civil war over the next four years , nearly tearing the nation apart forever .