I think everyone can agree that the North wasn't fighting for the enlightened reason of liberating the slaves. Mr. Lincoln himself proves it.
" I would save the Union. I would save it the shortest way under the Constitution. The sooner the national authority can be restored; the nearer the Union will be "the Union as it was." If there be those who would not save the Union, unless they could at the same time save slavery, I do not agree with them. If there be those who would not save the Union unless they could at the same time destroy slavery, I do not agree with them. My paramount object in this struggle is to save the Union, and is not either to save or to destroy slavery. If I could save the Union without freeing any slave I would do it, and if I could save it by freeing all the slaves I would do it; and if I could save it by freeing some and leaving others alone I would also do that. What I do about slavery, and the colored race, I do because I believe it helps to save the Union; and what I forbear, I forbear because I do not believe it would help to save the Union. I shall do less whenever I shall believe what I am doing hurts the cause, and I shall do more whenever I shall believe doing more will help the cause. I shall try to correct errors when shown to be errors; and I shall adopt new views so fast as they shall appear to be true views.
I have here stated my purpose according to my view of official duty; and I intend no modification of my oft-expressed personal wish that all men everywhere could be free."
Anyway... in the constitution, it seems that technically any state can leave the union under the 10th Amendment
However, if we accept the validity of the Supreme Court to declare the constitutionality of something as per Article III Section 2 Clause 2, then according to Texas v. White, it is unconstitutional.
But, since Texas v. White wasn't decided upon until 1869, the secession of the Southern States was contemporaneously constitutional.
So, in summation, it was a legal act, and the Federal Government committed the first hostile act of the Civil War, namely, not evacuating from the Southern States.