To what degree was the Supreme Court responsible for undoing the constitutional gains of reconstruction?

To what degree was the Supreme Court responsible for undoing the constitutional gains of reconstruction?