Question about the American civil war (from a non American)

by Turbotanks

I'll try and word this as best I can.

Why is the confederacy considered to be traitorous to the United States of America?

Obviously I understand that they went to war with them, but from what I've seen online (which is probably skewed) the second amendment says about "A well regulated milita, being necessary to the security of a free state" and this was ratified 90 years before the start of the civil war, so if the southern states felt that they were having their states rights restricted and therefore were no longer a free state would it not be their right to fight against what they deemed to be something stopping them being a free state?

I'm assuming that well regulated militia doesn't cover an army? Or is it the fact that they wanted to succeed from the union instead of just keep their rights that makes them traitorous?

Disclaimer: I don't support the Confederacy, or slavery and know "states rights" normally boils down to "states rights to own slaves"

Obligatory-Reference

The inimitable /u/Georgy_K_Zhukov has written about the causes of the Civil War in many places, including here.

I can't speak to how the 2nd Amendment was seen by people of the time, but to answer your first question directly, the Confederacy was considered to be traitorous to the US because they seceded. The prevailing sentiment in the North was that secession was illegal. Even outgoing president James Buchanan, a Pennsylvanian who had nonetheless sided with southern states throughout his term, was firm in this belief:

The Union was not "a mere voluntary association of States, to be dissolved at pleasure by any one of the contracting parties"... The framers of the national government "never intended to implant in its bosom the seeds of its own destruction, nor were they guilty of the absurdity of providing for its own dissolution".

This view stood in contrast to that of many people living in the South. As Zhukov mentioned in his answer, the Civil War was about slavery, but the "state's rights" argument does illustrate a philosophical difference between the South and the North - broadly, that those living in Southern states were more likely to consider themselves citizens of the state first and the nation second. This can also be seen in the Nullification crisis of the 1830s, when the state of South Carolina declared that federally imposed tariffs were "null and void" within the state.

Obviously, Lincoln agreed with Buchanan's view (one of the few times they would agree on anything), but he couldn't do anything about it until he was sworn in as president in March 1861 (the first state to secede, South Carolina, had done so the previous December). There was a wide range of opinion as to how to react to the secession. Buchanan was content to pass the buck, although he made a half-hearted effort at compromise that was roundly rejected by Republicans. A loud minority wanted to just let the seceded states go, in the belief that either there was a "silent majority" opposing secession who would pressure the state to return, or the secession experiment would fail and come back hat in hand. This sentiment soon faded and was replaced by a general "do-nothing" strategy, whereby the North would stand by and avoid any provocation while still maintaining that secession was illegal. This policy would end with the Confederate attack on Fort Sumter in April.