What are the most important reasons behind the swap of American political ideals, so that back then it was Republicans who ended slavery and Democrats who fought to keep it, but now it is republicans who are seen as racist and dems who are seen as the champions of civil liberties?

by acetominaphin
breakinbread

There are quite a few answers in the FAQ about how the Republican and Democratic parties have changed: https://www.reddit.com/r/AskHistorians/wiki/us_history#wiki_changing_role_of_republicans_and_democrats