I am going to posit that no, it was not. When the Southern attacked US troops at Ft. Sumter, they believed they were attacking a foreign army on their soil. This is absurd, because the fort was already US property and I’m guessing the Army didn’t pay VA taxes on it (so it wasn’t really a foreign incursion). In addition, there was no threat to a greater loss of CSA life by the presence of US troops at Fort Sumter, making military incursion unnecessary. On the other hand, Lincoln understood that to allow the Union to dissolve rather that to unite was foolish. So ardently did he believe he was saving something so dear to him, that he risked the lives of hundreds of thousands of young men. In no means would allowing the Southern States to secede have caused millions to die (which would have been necessary to justify such a bloody war).
Contrast that with the potential and supposed threat Iraqi WMD (in Al Qaeda hands) posed along with the deaths of 3000 innocents on 9/11 and we have a different story . In that case, merely standing by while Saddam (a vocal international terrorist supporter and anti-American) developed the WMD we thought he had and sold them to OBL would be more disasterous than the 3000 Americans killed in the war and the 50,000 Iraqis killed (though not by Americans). I won’t get into the rest of that anology here, but on that point, the potential loss of life by just letting Saddam continue his violations of the UN would outwiegh any estimated cost of lives by removing him.
If the war was over slavery, then its a different story, but it wasn’t.
In a similar vein, I believe the Revolutionary War to be immoral and unjust. While an ardent American patriot (who lives in the Northern States), I see the Revolutionary War as a child’s tantrum: we weren’t getting what we want, so we complained and took matters into our own hands. Does that mean that the Revolution was wrong, or that Washington and Jefferson and Adams were bad, bourgeois oppressors? No. Their ideas on independence and freedom and liberty were valuable. Does that mean the British were blameless? No. The Quartering Act and the Intollerable Acts and the Townshend Acts were gross usurpations of government authority, and the colonists were right to oppose them, not rebel. That said, it doesn’t make the war just.