According to a 2011 CNN/Opinion Research Corporation Poll, "most Republicans said slavery was not the main reason that Confederate states left the Union" (emphasis added).
But when the state of Mississippi seceded from the Union, it said: "In the momentous step which our State has taken of dissolving its connection with the government of which we so long formed a part, it is but just that we should declare the prominent reasons which have induced our course. Our position is thoroughly identified with the institution of slavery-- the greatest material interest of the world. Its labor supplies the product which constitutes by far the largest and most important portions of commerce of the earth. These products are peculiar to the climate verging on the tropical regions, and by an imperious law of nature, none but the black race can bear exposure to the tropical sun. These products have become necessities of the world, and a blow at slavery is a blow at commerce and civilization. That blow has been long aimed at the institution, and was at the point of reaching its consummation. There was no choice left us but submission to the mandates of abolition, or a dissolution of the Union, whose principles had been subverted to work out our ruin" (emphasis added). (See "A Declaration of the Immediate Causes which Induce and Justify the Secession of the State of Mississippi from the Federal Union.")
When Georgia seceded from the Union, it said: "The people of Georgia having dissolved their political connection with the Government of the United States of America, present to their confederates and the world the causes which have led to the separation. For the last ten years we have had numerous and serious causes of complaint against our non-slave-holding confederate States with reference to the subject of African slavery."
In Georgia's declaration of secession, "slave" or "slavery" is mentioned 36 times. (See "Confederate States of America - Georgia Secession.")
When Texas seceded, it complained that, "(The northern states) demand the abolition of negro slavery throughout the confederacy, the recognition of political equality between the white and the negro races, and avow their determination to press on their crusade against us, so long as a negro slave remains in these States."
Texas's declaration mentions "slave" or "slavery" 22 times. (See "DECLARATION OF CAUSES: February 2, 1861: A declaration of the causes which impel the State of Texas to secede from the Federal Union.")
Another important secession document was "The Address Of The People Of South Carolina, Assembled In Convention, To The People Of The Slaveholding States Of The United States." It was written by Robert Barnwell Rhett, a South Carolina politician and newspaper owner. In this document, "slave" or "slavery" is mentioned 30 times. Rhett declares: "South Carolina desires no destiny separated from yours. To be one of a great Slaveholding Confederacy, stretching its arms over a territory larger than any power in Europe possesses – with a population four times greater than that of the whole United States when they achieved their independence of the British Empire...We ask you to join us in forming a Confederacy of Slaveholding States."
So, was the Civil War primarily about slavery, or about states' rights? It seems to me that, even if we answer "states' rights," we have to add "to enslave people for personal profit." In other words, no matter how you slice it or how you dice it, it was about slavery.