Government officials cannot discriminate on the basis of race or religion. Except when they can, as the Supreme Court reminded us this week. The court's decision to uphold the entry ban illustrates how immigration has become a "Constitution-lite" zone, and the Trump administration's recent policies prove why that's not just a bad idea — it can be a horrific one.

The contrast between Trump vs. Hawaii, handed down on June 26, and the court's recent decision in Masterpiece Cakeshop vs. Colorado Civil Rights Commission underscores how presidents have few constraints when they exercise their vast power over immigration. In Masterpiece Cakeshop, the court concluded that the Colorado Civil Rights Commission violated the First Amendment when it attempted to penalize a baker for refusing to sell a cake to a same-sex couple. The court found that the commission's decision-making process was infected by religious hostility because one commissioner had expressed the belief that it is "despicable" to invoke religion to harm others.

In Trump vs. Hawaii, however, the court declined to reach a similar conclusion about the decision-making process that led to the entry ban. The majority of the justices avoided saying the entry ban was tainted by religious animus, even though President Donald Trump had promised a total and complete shutdown of Muslims entering the United States and declared "Islam hates us." Nor did the majority conclude that the entry ban failed to display religious neutrality, even though the first iteration of the entry ban warned of "violent ideologies" and contained an explicit preference for non-Muslim minorities in a country with a majority-Muslim population.

In explaining its 5-4 decision, the majority invoked a set of legal rules that limit the ability of the federal courts to assess decisions related to immigration, and specifically, determinations about who may enter the U.S. These rules have their roots in century-old decisions embracing the "plenary-power doctrine," which gives the political branches, and in recent times the president in particular, something of a blank check over immigration matters.

Among legal scholars, the plenary-power decisions are somewhat infamous. One of them, Chae Chan Ping vs. United States, known as the Chinese Exclusion Case, addressed a law that excluded persons of Chinese origin. No one doubted that the law at issue in that 1889 case was rooted in naked racism, and the court ultimately upheld the law by itself embracing that racism. The opinion warned of "foreigners of a different race in this country, who will not assimilate with us" and "be dangerous to its peace and security."

That fearmongering set the stage for the court's declaration that Congress and the executive branch have almost a free hand over immigration and that courts would not second-guess their decisions. The court repeated this reasoning four years later in Fong Yue Ting vs. United States, when it confronted a law requiring Chinese laborers to corroborate their residence in the U.S. with at least one white witness. The court upheld the law, again emphasizing the broad authority that political branches have over immigration and again interweaving that idea with blatant racism: The court explained the "great embarrassment, from the suspicious nature" of Chinese witnesses whose "loose notions ... of the obligation of an oath" would infect judicial proceedings.

The racial — and racist — origins of the plenary-power doctrine are there for everyone to see. Yet the court still relies on it when giving the political branches such sweeping authority over immigration.

The decision in Trump vs. Hawaii did so explicitly. The opinion explains the difference in the entry-ban case and other First Amendment challenges, that "the admission and exclusion of foreign nations is a 'fundamental sovereign attribute exercised by the Government's political departments largely immune from judicial control.'" The court quoted a passage from a prior case that relied on both the Chinese Exclusion Case and Fong Yue Ting to justify the idea that immigration is insulated from judicial review.

The court now justifies the broad authority of the political branches over immigration in terms other than naked racism. But papering over the racial origins of the political branches' sweeping immigration authority can do only so much. While the ideas behind the plenary-power doctrine may no longer be acceptable (at least in certain circles), invoking the president's near plenary authority over immigration allowed the court, in effect, to turn a blind eye to racism.

How else to interpret Trump's announcement, as a candidate, that he had a plan for a "total and complete shutdown" of Muslims entering the United States? Or his statement after signing the entry ban that "we all know what that means."

He's right; we do.

Which is why the entry-ban case shows how the plenary-power doctrine enables presidents and Congress to get away with blatant racism in immigration decisions.

Every day the Trump administration provides us a case study in how unchecked power over immigration risks humanitarian crises and moral wrongs. The administration was forcibly separating young children from their parents at the border with, initially, no apparent plan for reuniting them. It is criminally prosecuting people seeking asylum in the U.S. from unthinkable violence in their home countries. And it is making it extremely difficult for undocumented women in its custody to see medical professionals to perform abortions that will end pregnancies, some of which are a result of rape.

The Trump administration faces lawsuits that challenge these and other policies. In fighting off those challenges, the administration frequently argues that it has comparatively greater authority over immigration and that immigrants have relatively fewer constitutional protections, compared with other areas of law. Tuesday, the Supreme Court told the president he is right and that courts will not stop him from subjecting migrants to discrimination and abuses that this administration could not impose on citizens. The question is whether the rest of us will step up and stop the administration instead.

Leah Litman is an assistant professor of law at the University of California at Irvine. This column was first published in The New York Times.

What's your view?

Got an opinion about this issue? Send a letter to the editor, and you just might get published.