In the US, mainly because LBJ backed the civil rights movement. As he put it, " There goes the South for a generation", meaning Democrats wouldn't be able to win elections in the South. In the 19th century, the Democrats had been pro-slavery and later pro-segrigation (see Strom Thurmond), but between 1900-1950, the two parties rearranged themselves ideologically based on a variety of issues. Thurmond and the remainder of the old school Dixiecrats jumped ship to the opposing party after the mainstream Democrats took up the cause of civil rights.