Actually, it was fought to keep North America from picking up a new country.
I remind you that Lincoln himself said "If I could save the Union by freeing all of the slaves, I would do it. If I could save the Union by freeing none of the slaves, I would do that. If I could save the Union by freeing some of the slaves and leaving others in shackles, I would do that" (or something along those lines).