The civil war was not fought over slavery. That was later defined as a benefit of the war.
No, slavery was there from the beginning -- it was the first & major reason given in the secessionists' "Reasons for Secession" documents.
Slavery was a major reason for Union victory and Confederate defeat -- since the North freed & hired runaway slaves, including as combat soldiers, and the Confederacy could not.
During the Civil War runaway slaves quickly became an issue for the Union, and emancipation their response.
As a result, by war's end most of the Confederacy's 3+ million slaves were freed by Lincoln's Emancipation Proclamation.
By 1862 Julia Ward Howe's Battle Hymn of the Republic became a major inspiration for Union troops (and remains so today), including:
So, secession began over slavery, and Civil War ended freeing the slaves.
Those are facts.