Donald Trump's instantly infamous order barring immigrants and refugees from seven Muslim-majority countries from entering the United States has mobilized considerable opposition both on the streets and in the courts. A substantial number of lawsuits have already been filed, and they've had some tentative early successes against the immigration ban.

Now, the courts are in a position to provide a meaningful check on arbitrary and discriminatory actions by the executive branch. And this provides a solid opportunity to rethink the extreme level of deference generally accorded to the legislative and executive branches on immigration policy.

The legal case against Trump's partial ban is strong. On its face, targeting religious minorities without any serious national security justification violates the Establishment Clause of the 1st Amendment and the Due Process clause of the 5th. The strength of the case against the order was emphasized by Acting Attorney General Sally Yates announcing her refusal to defend the order in court. In response, Trump fired her. With Jeff Sessions set to take over the job, Trump's action was substantively unnecessary, but it reflects his dislike of criticism and insecurity, insecurity that it this case is eminently justified.

While intuitively, an order as obviously discriminatory and irrational as Trump's should be an easy case for the federal courts, there is one potential barrier: the so-called "plenary power" doctrine. The federal courts have traditionally been very deferential to immigration policies established by the legislative and/or executive branches. Policy choices that, in other contexts, would be obviously found to violate basic standards of equal protection or due process have been upheld in the context of immigration.

However, this doctrine is in serious need of revision by the courts, and has been undermined over time. As Jonathan Hafetz of the Seton Hall School of Law explains, the doctrine is anomalous in American constitutional law. Article I, for example, establishes many plenary congressional powers, but few people argue that exercises of these powers are therefore beyond the power of judicial review. It's reasonable to argue that the executive branch's exercise of its powers over immigration are entitled to a presumption of constitutionality, but it's far less obvious that this presumption should not be rebuttable.

Even if one is sympathetic to the plenary power doctrine as applied to immigration in the abstract, the most important justifications for judicial deference are not applicable to this particular order and the process that produced it.

The first defense for extreme judicial deference pertains to the national security justifications offered by the Trump administration for its actions. Many have argued that the courts should be very deferential to the executive in cases of national security, that they lack the knowledge and expertise of the executive branch. Sometimes, it seems clear that this deference has gone too far in the past. For example, when the Supreme Court indefensibly upheld the internment of people of Japanese descent by the Roosevelt administration in 1944, it was clear that the order lacked any serious military justification and was motivated in large measure by racial animus that long predated the bombing of Pearl Harbor, but the justices either overlooked this or chose not to find out because of the tradition of deference to the executive branch in wartime.

But even if one argues that Korematsu was the case of a good doctrine carried too far, a high level of deference is particularly inappropriate as applied to this current case. The process behind Trump's order was slapdash and inept to a degree that would be comic if the consequences weren't so dire for so many innocent people. The relevant agencies were mostly cut out of the loop, and there was disagreement within the administration over the implications of the order. The driving force behind it appears to be Trump's chief strategist Stephen Bannon, an alt-right publisher and writer with no relevant national security experience. Even if the premise that the judicial branch should defer to the expertise of the executive branch is generally sound — and this is dubious in itself — it would be bizarre to apply it in a case in which no actual expertise appears to have been involved the executive action.

The second justification for judicial deference is that, particularly on an issue as central to the function of government as national security, unelected judges should be extremely wary of overriding the decisions of elected officials who are accountable to the people. While there is some truth to this in general, there are also some obvious limitations to the argument — most notably, very few people think democracy is just simple majoritarianism, and there are many counter-majortarian features that structure the elected branches in the United States.

In the case of the Trump administration, though, an extreme level of deference based on democratic norms seems especially inappropriate. Trump's mandate to speak for the American people is shaky at best. Despite the FBI putting a probably decisive thumb on the scales less than two weeks before the election, Trump lost the popular vote by nearly three million votes, thanks to the fact that we select the president based on an anachronistic mechanism originally designed to limit democracy and overrepresent the interests of slaveholders.

Rules are rules, and Trump is entitled to exercise the formal powers of his office. The courts should not overrule his actions based on mere policy disagreement. But in this context, to argue that on national security issues, democratic norms require a level of deference from the courts that would require judges to overlook what would otherwise be clear violations of the Constitution would be perverse.

Trump's immigration orders should not be exempt from serious judicial scrutiny. And when courts apply that scrutiny, they are very likely to find that Trump's order did not comport with the fundamental requirements of the Constitution.