By the time most American schoolchildren enter high school, they are generally familiar with bits and pieces of U.S. legal history, especially as it relates to discrimination. In particular, Supreme Court cases such as Dred Scott v. Sanford, Plessy v. Ferguson and Korematsu v. United States command unique attention in the nation’s conscience because, in hindsight, the decisions seem so strikingly wrong.

In Dred Scott, the Supreme Court held that black people could not be citizens. In Plessy, the court gave new legal force to the “separate but equal” doctrine, holding that it was constitutional for Louisiana to have racially segregated railway cars. In Korematsu, the court signed off on Japanese internment. These cases make up what legal scholar Jamal Greene refers to as “the anticanon,” because they are bad precedent on which judges rarely rely when deciding a case.

American legal and racial history are often celebrated through a broadly progressive lens, through which these cases are dismissed as mistakes or part of America’s darker moments. But a recent case suggests that the qualities that give the anti-canon its disrepute stubbornly persist in American jurisprudence — and are quite compatible with, even necessary to, American constitutionalism.

Last year, in Trump v. Hawaii, the court revisited an executive order issued by President Trump, in which he restricted travel and immigration to the United States from a number of countries, some of which had Muslim-majority populations. It was the third iteration of the order (the other two had been struck down by lower federal courts) and was strongly tied to Trump’s campaign promise to ban Muslims from entering the United States.

The order itself, though, did not mention any particular group of people and was thus “facially neutral toward religion.” That didn’t stop four Supreme Court justices from disagreeing with the majority opinion, however. In her dissent, Justice Sonia Sotomayor argued that the majority opinion was based on “dangerous stereotypes” about “a particular group’s supposed inability to assimilate and desire to harm the United States.” Its reasoning was similar to that in the Korematsu decision, she wrote, a claim to which the majority took offense.

Indeed, the majority seized the chance to officially overrule Korematsu. Chief Justice John G. Roberts Jr. wrote, “The dissent’s reference to Korematsu … affords this Court the opportunity to make express what is already obvious: Korematsu was gravely wrong the day it was decided.” To reconcile rejecting Korematsu while upholding the travel ban, the majority argued that Trump was not a case about citizens, like Korematsu, but about aliens attempting to enter the country.

Yet wherever one lands on the constitutionality of the executive order, the court’s reasoning in Trump should not be taken as a betrayal of American values — at least, not as they’ve been historically expressed.

While critics of the decisions in the anti-canon point to how democratic values and the protection of individual rights are at the core of our constitutional structure, those ideals have been regularly counterbalanced by a constitutional history of restrictive nationalism and state consolidation of power. As legal historian Robert Tsai argues, “If the Constitution has prevailed as an ideal, it has been through increasingly complex strategies to match the outbursts of the discontented” in American history.

Such “outbursts” drove the events that paved the way for Plessy, which legitimated a regime of segregation and discrimination that lasted for decades. Reconstruction, the federal effort to protect the rights of black Americans after the Civil War, formally ended as a result of the Compromise of 1877, in which Southern Democrats agreed to cede the 1876 election to Republican Rutherford Hayes (over Democrat Samuel Tilden) in return for the complete withdrawal of federal troops from the South. Before the compromise, thousands of Tilden’s supporters threatened violence in the event that he was not elected. Placating them by withdrawing federal troops allowed white Southerners to construct the Jim Crow regime that Plessy sanctified.

The decision to abandon and denounce long-standing practices such as slavery came with enormous compromises, and if compromise is a part of democracy, then every instance of progress must involve some restraint on the new frontiers of success that we celebrate. There will always be resistance to a Supreme Court decision to favor the oppressed or the wronged, even from within the court itself. Such disagreement — often touted as a hallmark of democracy — can leave the American people questioning whether the court is pronouncing on the law, or if it is largely subject to the whims of nine high-strung jurists.

Take Justice Clarence Thomas, who continues to be the subject of endless public fascination almost three decades after his controversial nomination hearings. Nowhere is Thomas’s puzzling jurisprudence more obvious than in his dissent this term in Flowers v. Mississippi, which concerned racial discrimination in jury selection in the case of a black man who was tried six times in the murder of four people. The court, in a majority opinion written by Justice Brett M. Kavanaugh, held that the trial court at Flowers’s sixth trial erred in concluding that the prosecution striking a prospective black juror was not racially motivated. Thomas, in a cutting attack on the majority, wrote that the court “almost entirely ignores — and certainly does not refute — the race-neutral reasons given by the State” for striking five black jurors. He did not think that the court should have even taken the case to begin with, and he angrily accused the majority of deciding the Flowers case to “boost its self-esteem.”

Americans who reject Thomas’s conclusions comfort themselves with the knowledge that they didn’t choose to put him on the court — that it is an institution mostly impervious to popular will. But the fact that liberals especially have used federal courts in furtherance of civil rights for decades means that the most “undemocratic” of the three branches can — as is well established — completely dodge the sentiments of millions of people in ruling on important issues (not everyone wanted desegregated schools). Had Flowers turned out the other way, it might surely have been compared to cases in the anti-canon.

In Flowers, the court secured minority rights, and the fight against racism was successful. But that doesn’t necessarily mean the courts are the best safeguards of liberalism. What risk do liberals take in relying too much on the courts? Is the anti-canon the price they are willing to pay for outcomes such as those in Flowers? Or Brown v. Board of Education?

As Americans know all too well, issues of racism persist. Over the past two decades, Justice Anthony M. Kennedy’s opinions came to reflect a tension in balancing historical inequities and the excessively divisive nature of equal-protection race discrimination cases, an approach that legal scholar Reva Siegel calls “antibalkanization.” That is, Kennedy believed the court should curtail laws that attempt to remedy racial inequities, because those laws might have the effect of exacerbating racial differences, as the decades-long fight over affirmative action in higher education indicates.

Kennedy’s struggle with race was evident in a 2007 opinion striking down Seattle’s use of race to maintain diversity in its public schools, in which he wrote, “The enduring hope is that race should not matter; the reality is that too often it does.” Courts oscillate between the realization of democracy’s most celebrated ideals (as in Flowers or Brown v. Board of Education) and the hefty price that we pay for living with people (and judges) who might make massive mistakes in moral and legal judgment (as in Dred Scott or Korematsu).

Are we then shamefully misguided about the egalitarian potential of democracy? What if the anti-canon is not democracy in error, but democracy in action? Does that mean we are misleading our children about the promise of democracy, by framing the anti-canon as an array of mistakes, when in fact it represents — nay, emboldens — the vitality of the legislative process and executive power?

The anti-canon suggests that our ability to provide equality for all is oddly limited. We as democratic citizens empower and celebrate the perpetrators of America’s rich tapestry of intolerance: our elected bodies and officials. Or as legal philosopher Edmond Cahn put it, “The new predicament of democratic man is his moral involvement in the misdeeds of government.”