In the 1803 case Marbury v. Madison, the Supreme Court took for itself the power to determine the meaning of the Constitution. Ever since, the federal courts have used judicial review, selectively, as a counterweight to majority rule.
The court has hit historic high points by siding with minorities that lack political power, especially to expand civil rights. The signature example is the unanimous 1954 ruling that called for an end to legally mandated school desegregation in Brown v. Board of Education — a ruling embraced by every recent nominee to the court, across the ideological spectrum.
But the court has also gone historically off course in making major counter-majoritarian moves — and been smacked down for it by the elected branches. In the aftermath of the Civil War, Congress passed a law requiring the Southern states, in order to re-enter the Union, to allow Black people, as well as white, to vote to ratify the 14th Amendment, which promised equal rights.
When this pillar of Reconstruction was challenged in the case Ex Parte McCardle, Congress worried that the Supreme Court would strike it down. So it stripped the court’s jurisdiction over Reconstruction and raised the number of justices to nine. (It was the third time Congress had changed the number of justices during the 1860s.)