Yes, the secession of the Confederate states was illegal.
It's important to understand that secession was not strictly, or merely, a “legalistic” matter. Secession was a hotly contested political issue that divided the electorate. It could not be settled by a judge. Any ruling in one direction or the other would be rejected by half of the population. See the last section here, esp the concluding two paragraphs, for a fuller discussion of this.
However, to the extent that secession was a LEGAL question, the “legalistic” aspect is very straightforward.
This answer is in three main sections: the law of the land, the arguments in support of the legality of secession, and why those arguments fail. Then there are two follow-up sections, on historiography and later legal commentators.
The Law of the Land
Unilateral secession has been illegal since the Articles of Confederation. No one ever mentions this, but the full title of that document was the "Articles of Confederation and Perpetual Union Between the States of [list]". (Emphasis added, obviously.) Article 13 laid out a possible mechanism for secession. It said:
"And the Articles of this Confederation shall be inviolably observed
by every State, and the union shall be perpetual; nor shall any
alteration at any time hereafter be made in any of them, unless such
alteration be agreed to in a congress of the united states, and be
afterwards confirmed by the legislatures of every state."
That language is awkward for modern ears to parse. I bolded the word "them" above. If "them" refers to the Articles, then this is a sentence about amending the Articles. But if "them" refers to the States, then this could be construed as a sentence about changing the composition of the States or changing the membership of the Union. So here is a potential legal way out of the Union: propose it in Congress, win passage there, and then get it ratified by every state. We might call that a "consensual", cooperative, amicable secession. But there's no support in the Articles for unilateral secession, where a state just decides on its own to leave.
The Articles created a much weaker national government, than the Constitution did. It follows that the stronger and "more perfect Union" created by the Consitution is, if possible, even more perpetual than the Perpetual Union created by the Ariticles. Certainly not conditional, or "less perpetual". That's the exact reasoning used by the Supreme Court in Texas v White. The Constitution says it is the supreme law of the land: there's no room for a state government to suspend or nullify it.
Here's the relevant section from the 1869 Texas v White ruling, which defines the current law of the land:
The Union of the States never was a purely artificial and arbitrary
relation. It began among the Colonies, and grew out of common origin,
mutual sympathies, kindred principles, similar interests, and
geographical relations. It was confirmed and strengthened by the
necessities of war, and received definite form and character and
sanction from the Articles of Confederation. By these, the Union was
solemnly declared to "be perpetual." And when these Articles were
found to be inadequate to the exigencies of the country, the
Constitution was ordained "to form a more perfect Union." It is
difficult to convey the idea of indissoluble unity more clearly than
by these words. What can be indissoluble if a perpetual Union, made
more perfect, is not?
When, therefore, Texas became one of the United States, she entered
into an indissoluble relation. All the obligations of perpetual union,
and all the guaranties of republican government in the Union, attached
at once to the State. The act which consummated her admission into the
Union was something more than a compact; it was the incorporation of a
new member into the political body. And it was final. The union
between Texas and the other States was as complete, as perpetual, and
as indissoluble as the union between the original States. There was no
place for reconsideration or revocation, except through revolution or
through consent of the States.
Considered therefore as transactions under the Constitution, the
ordinance of secession, adopted by the convention and ratified by a
majority of the citizens of Texas, and all the acts of her legislature
intended to give effect to that ordinance, were absolutely null. They
were utterly without operation in law.
One might wonder: was the 1869 ruling consistent with what the Founders had to say?
The debates at the Constitutional Convention don't have much to say about secession – possibly because the issue was already settled by the "perpetual" nature of the existing Union. There is a letter from Madison to Hamilton on the topic, from the Ratification era. Madison says:
"My opinion is that a reservation of a right to withdraw if amendments
be not decided on under the form of the Constitution within a certain
time, is a conditional ratification, that it does not make N. York a
member of the New Union, and consequently that she could not be
received on that plan. Compacts must be reciprocal, this principle
would not in such a case be preserved. The Constitution requires an
adoption in toto, and for ever. It has been so adopted by the other
States." (Letter to Hamilton, July 1788)
The money soundbite is right there, the last 2 sentences.
Madison had more to say on secession much later in his life, when he was in his 80s, in letters to Trist (1830), and again to Trist (1832), and to Rives (1833), and to Daniel Webster (1833). I'm not bringing any of those quotes inline, as the letters don't date from the Ratification era; but they are from the Father of the Constitution, so they are worth looking at. Madison was of course a Virginian and a slaveowner.
Weak old Buchanan (of all people!) also made a Ratification-argument. In Buchanan's 4th annual message, just two weeks before South Carolina seceded, he said:
In order to justify secession as a constitutional remedy, it must be
on the principle that the Federal Government is a mere voluntary
association of States, to be dissolved at pleasure by any one of the
contracting parties. If this be so, the Confederacy is a rope of sand,
to be penetrated and dissolved by the first adverse wave of public
opinion in any of the States. In this manner our thirty-three States
may resolve themselves into as many petty, jarring, and hostile
republics, each one retiring from the Union without responsibility
whenever any sudden excitement might impel them to such a course. By
this process a Union might be entirely broken into fragments in a few
weeks which cost our forefathers many years of toil, privation, and
blood to establish.
Such a principle is wholly inconsistent with the history as well as
the character of the Federal Constitution.
Buchanan also pointed out some pretty strong negative evidence: in the long fight for Constitutional ratification, no one ever tried to persuade reluctant states by arguing that:
"the moment that any state felt herself aggrieved she might secede
from the Union. ... What a crushing argument would this have proved
against those who dreaded that the rights of the States would be
endangered by the Constitution!"
Generally the absence of counter-evidence is not the same thing as positive evidence. But this actually is a strong point. Constitutional ratification was protracted and difficult, with extensive discussion by the leading political minds of the day. They didn't just FORGET to mention a right to withdraw, if one existed.
Robert E Lee himself agreed with this view. In a letter to his eldest son in January 1861, he wrote:
Secession is nothing but revolution. The framers of our Constitution
never exhausted so much labor, wisdom, and forbearance in its
formation, and surrounded it with so many guards and securities, if it
was intended to be broken by every member of the Confederacy [league?] at will.
It was intended for “perpetual union,” so expressed in the preamble,
and for the establishment of a government, not a compact, which can
only be dissolved by revolution, or the consent of all the people in
convention assembled. It is idle to talk of secession. Anarchy would
have been established, and not a government, by Washington, Hamilton,
Jefferson, Madison, and the other patriots of the Revolution.
That word "Confederacy" in the above quote is confusing. The actual Confederate States of America did not exist when Lee wrote the letter. I think he's using it in the general sense of "league or alliance", basically another way to refer to the Union; or else to the govt established by the Articles of Confederation. Lee's assessment matches that of his fellow Virginian, Madison. And the way he calls out the "perpetual union" language precisely foreshadows the later Supreme Court ruling in Texas v White.
The argument in support of secession
The basic argument is that the states agreed to enter into the US Constitution, like a contract, so they could decide to leave (terminate). But by itself that argument is severely flawed. Either party can opt NOT TO ENTER a contract; entering into a contract is voluntary. But once a contract is entered into, it takes BOTH parties to dissolve it. One party can't dissolve a contract unilaterally.
To support unilateral secession, supporters invoke what is called "Compact Theory". Under Compact Theory, the Union is not a national government, but instead a compact between independent sovereign states. Somewhat like a League of Nations. Nations can unilaterally rescind treaties; so, under Compact Theory, could the states unilaterally rescind their membership in the US. Like France leaving NATO, or Australia pulling out of the UN.
You can see Lee referencing the theory in his letter to his son (above), in his use of the word "compact". Buchanan references it too, as "the principle that the Federal Government is a mere voluntary association of States, to be dissolved at pleasure by any one of the contracting parties." Compact Theory had a long and respectable pedigree in American politics; it was no fringe theory. Jefferson articulated it quite clearly in his 1798 draft of the Kentucky Resolutions.
This is really the entire argument. The states are not bound by anything like contract law. The states are sovereign, they entered into a compact, and they can withdraw from it at will.
Why the argument fails
Compact Theory had already been rejected by the Supreme Court in 1816, 44 full years before South Carolina seceded. The case was Martin v. Hunter's Lessee (1816). By the way, 4 of the 6 Justices who participated in that ruling were Southern (one of them was George Washington's nephew). The ruling was that the Constitution was not an agreement between the states at all; rather, as the preamble says, it was ordained and established directly by the people. Justice Story wrote as part of the majority:
“The Constitution was for a new Government, organized with new
substantive powers, and not a mere supplementary charter to a
Government already existing. The Confederation was a compact between
States, and its structure and powers were wholly unlike those of the
National Government. The Constitution was an act of the people of the
United States to supersede the Confederation...”
The status of Compact Theory was reiterated in McCulloch v. Maryland (1819); still 41 years before secession. 5 of the 7 sitting Justices in that case were Southern (still including the nephew); and the decision was unanimous. McCulloch extended Martin, saying that "the constitution and the laws made in pursuance thereof are supreme ... they are binding on the states and cannot be controlled by them." This directly rejects Compact Theory, which would hold that the federal government is a creation of the states, where the states maintain superiority.
Both cases draw a distinction between the Articles of Confederation and the Constitution. In Martin the Court says that the Articles were a "Compact", but the new government is not. In McCulloch the Court says that there is no phrase in the Constitution, unlike the Articles, that "excludes incidental or implied powers". (Meaning that under the Constitution, the Fed govt has more power than what is explicitly mentioned in the document: it also has incidental or implied powers. The Fed govt did not have those under the old Articles.)
You can actually go back to Chisholm v. Georgia (1793) to see compact theory get its first beating from the Court. This was the original Court appointed by George Washington. That ruling was that the People directly established "a Constitution by which it was their will that the State governments should be bound." Supreme or sovereign power was retained by citizens themselves, not by the "artificial person" of the State of Georgia. 1793! The 11th amendment undid part of Chisholm, making it impossible for citizens to sue other states in federal court; but it conferred Sovereign Immunity, not Sovereignty. No support for Compact Theory there.
It's very straightforward. By 1820, Southern majorities of the Supreme Court had already rejected the only argument in support of the legality of secession, THREE TIMES. That's well before secession, and Texas v White.
That's just the actual opinions of the court. The standard work on Constitutional law in the 1800s was Justice Joseph Story's Commentaries on the Constitution of the United States (1833). Called "a cornerstone of early American jurisprudence" and still referred-to. Story doesn't mince words when it comes to Compact Theory:
In what light, then, is the constitution of the United States to be
regarded? Is it a mere compact, treaty, or confederation of the states
composing the Union... ? There is nowhere found upon the face of the
constitution any clause, intimating it to be a compact, or in anywise
providing for its interpretation, as such. On the contrary, the
preamble emphatically speaks of it, as a solemn ordinance and
establishment of government. The language is, 'We, the people of the
United States, do ordain and establish this constitution for the
United States of America.' The people do ordain and establish, not
contract and stipulate with each other. The people of the United
States, not the distinct people of a particular state with the people
of the other states. The people ordain and establish a constitution,'
not a confederation.' . . . Nor should it be omitted, that in the most
elaborate expositions of the constitution by its friends, its
character, as a permanent form of government, as a fundamental law, as
a supreme rule, which no state was at liberty to disregard, suspend,
or annul, was constantly admitted, and insisted on, as one of the
strongest reasons, why it should be adopted in lieu of the
Story honestly goes on for like 20 pages on this topic. See volume 1 ,"book 3", chapter 3 of his commentaries (viewable on Google Books).
I'll let Daniel Webster summarize. Senators and congressmen cannot have the same force when speaking about the interpretation of the Constitution, as actual Supreme Court justices. The point is what the Supreme Court itself decided, along with the definitive Constitutional commentary of its day. But Webster expressed it with great clarity on the floor of the US Senate in 1830. See his "Reply to Hayne", collected in numerous places.
He has not shown, it cannot be shown, that the Constitution is a
compact between State governments. The Constitution itself, in its
very front, refutes that idea; it declares that it is ordained and
established by the people of the United States.
When the gentleman says the Constitution is a compact between the
States, he uses language exactly applicable to the old Confederation.
He speaks as if he were in Congress before 1789. He describes fully
that old state of things then existing. The Confederation was, in
strictness, a compact; the States, as States, were parties to it. We
had no other general government. But that was found insufficient, and
inadequate to the public exigencies. The people were not satisfied with
it, and undertook to establish a better. They undertook to form a
general government, which should stand on a new basis; not a confederacy,
not a league, not a compact between States, but a Constitution; a
popular government, founded in popular election, directly responsible
to the people themselves, and divided into branches with prescribed
limits of power, and prescribed duties. They ordained such a government,
they gave it the name of a Constitution, and therein they established a
distribution of powers between this, their general government, and
their several State governments.
Webster's speech came in the midst of the Nullification Crisis. So from one perspective it is of limited utility as "proof": there was a whole other side in that crisis, with a counter-argument of their own. But Webster's speech is nice because he very neatly articulates the viewpoint of the three relevant Supreme Court decisions and Justice Story's Commentaries. A good summation.
If you're serious in asking the question (I suspect you are not), it's important to understand that in the historiography of the Civil War, this question is one of the Southern Apologist arguments. Saying that secession was legal until the Court issued its 1869 ruling in Texas v White, implies that there was no legal basis for the Court's ruling, ie it's pure judicial fiat. That's a pure Southern Apologist argument. The rest of the logic goes: "secession was not illegal until 1869, therefore secession was LEGAL up until 1869, therefore Lincoln's use of armed force to put down the slaveholders rebellion was illegal." The line of argument is used to paint Lincoln as a criminal, an aggressor, a dictator.
And it's not true. Texas v White was pure Stare Decisis: the opposite ruling would have violated previously stated law. The law underpinning the decision had been settled back in 1816.
Later Legal Commentary
There is some discussion about whether later legal commentary contradicts the argument from the 1816 and 1819 rulings. At least three times since 2000, judges have stated that the question of a state's ability to secede was unsettled prior to the Civil War. That has occurred in a Supreme Court ruling, in a Supreme Court justice's correspondence, and in a state supreme court ruling. These are below. I added emphasis in each, to pull out the common idea; there is no special emphasis in any of the original docs.
"At the time, the phrase 'one Nation indivisible' had special meaning
because the question whether a State could secede from the Union had
been intensely debated and was unresolved prior to the Civil War." (
Elk Grove Unified Sch. Dist. v. Newdow, 542 U.S. 1, 6 n. 1, 124 S.Ct.
2301, 159 L.Ed.2d 98 (2004). )
"If there was any constitutional issue resolved by the Civil War, it
is that there is no right to secede."
- In 2010 the Alaska state supreme court wrote that:
"While a state's ability to secede was an unsettled question before
the end of the Civil War, subsequent United States Supreme Court
opinions have concluded that secession is clearly unconstitutional,
and Lincoln's belief in a perpetual Union is reflected in what we have
described as 'a plenitude of Supreme Court cases holding as completely
null' the acts of secession by Confederate states."
Is there a contradiction here?
No. It's important to note that none of these jurists (except for the second half of Alaska, after the word "subsequent") reference any legal action or court rulings. SCOTUS 2004 does NOT say, "the question whether a state could secede was unresolved prior to Texas v White." Scalia does not write, "the constitutional issue resolved by Texas v White is that there is no right to secede." The Alaska court does not say, "a state's ability to secede was unsettled before Texas v White." What they all mention is the war. All of these jurists are saying that the Civil War itself settled the question. Not any court ruling: the actual WAR.
And that's the truth. Secession was not a legalistic question that the courts could settle, by examining the Constitution and accumulated Supreme Court precedent. A good comparison is the Dred Scott ruling. There, Justice Taney intended to settle the question of slavery in the territories, and of negro citizenship. The ruling did not come anywhere close to settling that question; if anything, it inflamed the controversy. The ruling is routinely cited as one of the incidents that escalated sectional tension, in the long lead-up to the war.
Likewise secession. Secession was a political (and military!) question. As late as the Summer of 1864, it was still an open question whether the Federal govt had the political support to defeat secession. Imagine if Lincoln had lost the 1864 election, it's easy to envision the winning "Peace Democrats" negotiating a peace, leaving the Confederacy in place. In that alternate hypothetical, a later SCOTUS would likely have to acknowledge that although secession might be de jure illegal, it had de facto occurred. That hypothetical Court might conclude that the US citizens had not shown a determination to maintain the Union; obviously it was possible to secede, since it had happened. It would be the opposite ruling not because the underlying law & precedents would have changed, but because the facts would have changed.
It took the WAR to settle the question of secession. That's what we see in history, and that's what the 21st century judges are commenting on.