This compendium of declarations of several southern states stating the reasons for breaking away, specifically mention slavery, and the anti-slavery efforts of the northern states as a primary reason for breaking away. This didn't happen overnight... slavery had been a contentious issue for some time, producing among other things the Mason-Dixon line.
To add perspective, this wasn't so much a matter of good and evil, more that the agrarian south relied heavily on slave labor while the industrial north had learned that slaves don't do very well in the more complex industrial jobs prevalent in the northeast US. The north could easily take a 'virtuous' stand because it wasn't giving up anything in the process.
Another factor: tariffs put in place by the federal government to protect the emerging northern industry by curtailing manufactured goods import from Europe brought down retaliatory tariffs by Europe, which reduced the primary export of the US: agricultural goods like cotton, which came from the southern states.
Nor did the north invade the south with the explicit goal of abolishing slavery.
So, while the slavery debate was the most visible symbol of differences, the economic inequity visited on the agriculture of the south to benefit the industry of the north was also a motivating factor.
Figuring out if there was any great degree of virtue on the part of the 1860's federal government is a bit more difficult.
No less than Abraham Lincoln, while president, proposed plans to remove the former slaves from the US, and relocate them, either to British Guyana (Belize), or back to Africa. His untimely death put an end to that idea, despite some contemporary articles that publish unsourced and uncredited accounts that Lincoln had changed his mind on this plan. There was an effort to send Africans back to Africa: the nation of Liberia was created in the 1800's, and populated with former slaves sent back to Africa.
So it would appear that while the north didn't want slavery, they weren't exactly in favor of the former slaves living among them.
In fact, discrimination against Africans by the federal government didn't see any great curtailment until the 1950's. WW2 was fought by segregated troops with blacks relegated to service posts: construction, truck driving, cook, with the general (and incorrect) belief that blacks weren't good combat soldiers. Similar military segregation was not visited upon other ethnic groups.
And this sudden outburst of 'virtue' didn't stop the same federal government from committing genocide against native tribes in the west, or exploiting the Chinese and killing quite a few of them, while building the railroads. Both of those events happened in in the late 1800's.
Viewed from the perspective of the time, the 'virtue' looks more like a matter of convenience, because it was not accompanied by any sacrifice on the part of the north, nor were the ostensibly high morals championed as the source of the anti slavery efforts evident in how the north treated other minorities, or even how they treated the Africans after the war.