Answer:
It was put in place, little by little, in the Reconstruction era, after the Civil War, culminating in what were known as "Jim Crow" laws. The U.S. Supreme Court codified it in the landmark case, "Plessy v. Ferguson" in 1896. It was finally overturned in 1954, by the Supreme Court, in "Brown v. Board of Education".