The reason for the war was because Southern leaders refused to accept the results of an election that brought in an anti-slavery administration.  But even before that administration took office, they passed ordinances of secession that -- uniformly -- mentioned the preservation of slavery as their key goal.  And yes, Lee fought to maintain that.

In response to all of this, Lincoln fought to preserve the union.  Over time, he realized that freeing the slaves was a key step to victory.  But since he didn't start the war, his motivation wasn't the reason for the war.

Indeed, try reading history.