As long as you don't ask the traitor leadership, who said over and over again that the war is explicitly about slavery and enslaving PoC in particular. The legalization of slavery was a requirement for entry into the confederacy. It was built into their constitution that anyone who wanted to join had to allow slavery.
And let's not forget that it was plainly written or alluded to (calling it a 'peculiar institution') into nearly all of traitorous states' declarations of secession.