The North was fighting to preserve the Union. The South was fighting to become Independent of it.
The Declaration of Independence (the founding document of the United States) says the South had a right to leave.
Governments are instituted among Men, deriving their just powers from the consent of the governed,--That whenever any Form of Government becomes destructive of these ends, it is the Right of the People to alter or to abolish it, and to institute new Government, laying its foundation on such principles and organizing its powers in such form, as to them shall seem most likely to effect their Safety and Happiness.
Except the Southern States still will part of a Rrpublican government with the consent of the governed. In fact they controlled the Supreme Court. Just like Gore vs Bush, Democrats wanted to suppress the consent if the governed and play by their own rules.