There's a lot to be said about this morning's Trump v. Hawaii decision, and I will say little of it. But I do want to summarize what I think is the core legal principle behind the majority's constitutional position: The federal government may pick and choose which foreigners to let into the country (at least setting aside foreigners who have are already been granted residence), even based on factors -- political beliefs, religion, and likely race and sex -- that would normally be unconstitutional.
This used to be called the "plenary power" doctrine, referring to the principle that the government has essentially unlimited power when it comes to at least this aspect of immigration law, unlimited even by the Bill of Rights. It is not based on the constitutional text; textually, the First Amendment would apply to all exercise of Congressional authority, whether under the Commerce Clause or the District of Columbia Clause or the Necessary and Proper Clause under Congress's power over immigration. But, right or wrong, it is based on longstanding American legal history; and the majority adheres to that history.
Historically, this has even be used to authorize Congress to discriminate based on race (query whether the Court would today condemn this as "irrational"; more on that below). It has long been seen as authorizing Congress to discriminate based on country of citizenship, without investigation into whether such discrimination might actually be motivated by ethnic hostility. And, most relevant to today's decision, it was seen in Kleindienst v. Mandel (1972) as authorizing discrimination based on political ideology, which would otherwise be forbidden by the First Amendment. (Other past Supreme Court precedents are also consistent with Kleindienst, and some even go further in some respects, but for the sake of simplicity I will focus on Kleindienst here.)
Ernest Mandel was a Belgian "revolutionary Marxist" professor who was invited to speak at various U.S. universities. The government denied him a visa, and he and his inviters sued, claiming this violated the First Amendment.
The Court acknowledged that the First Amendment extends to American listeners and not just to American speakers: Even if one concludes that foreigners outside the U.S. don't have First Amendment rights, and that the government wouldn't affect Mandel's First Amendment rights by excluding him, the exclusion did affect the inviters' First Amendment rights.
Yet the Court rejected the First Amendment claim:
Recognition that First Amendment rights are implicated, however, is not dispositive of our inquiry here. In accord with ancient principles of the international law of nation-states, the Court in The Chinese Exclusion Case (1889), and in Fong Yue Ting v. United States (1893), held broadly, as the Government describes it, that the power to exclude aliens is "inherent in sovereignty, necessary for maintaining normal international relations and defending the country against foreign encroachments and dangers—a power to be exercised exclusively by the political branches of government ...." Since that time, the Court's general reaffirmations of this principle have been legion. The Court without exception has sustained Congress' "plenary power to make rules for the admission of aliens and to exclude those who possess those characteristics which Congress has forbidden." Boutilier v. Immigration and Naturalization Service (1967). "[O]ver no conceivable subject is the legislative power of Congress more complete than it is over" the admission of aliens. Oceanic Navigation Co. v. Stranahan (1909)....
Mr. Justice Frankfurter ably articulated this history in Galvan v. Press (1954), a deportation case, and we can do no better. After suggesting that "much could be said for the view" that due process places some limitations on congressional power in this area "were we writing on a clean slate," he continued:
"But the slate is not clean. As to the extent of the power of Congress under review, there is not merely 'a page of history'... but a whole volume. Policies pertaining to the entry of aliens and their right to remain here are peculiarly concerned with the political conduct of government. In the enforcement of these policies, the Executive Branch of the Government must respect the procedural safeguards of due process.... But that the formulation of these policies is entrusted exclusively to Congress has become about as firmly embedded in the legislative and judicial tissues of our body politic as any aspect of our government...."
As a result, the Court held that, if decisions to exclude aliens could ever be set aside, this would be so only if there was no "facially legitimate and bona fide" reason to exclude the alien. In Mandel's case, the dissent noted, those reasons -- labeled by the government as Mandel's "flagrant abuses" during his past visits to the U.S. -- "appear merely to have been his speaking at more universities than his visa application indicated." The dissent argued that "It would be difficult to invent a more trivial reason for denying the academic community the chance to exchange views with an internationally respected scholar." But the Court didn't investigate whether the government's true motive might have been the Administration's disapproval of Mandel's political ideas, rather than the supposed violation of past visa conditions; the requirement of a "bona fide" reason did not appear to require an investigation into the government's true motivations, but rather simply focused on whether the "facial" reasons seemed sufficient:
In summary, plenary congressional power to make policies and rules for exclusion of aliens has long been firmly established. In the case of an alien excludable under [the provision involved in Mandel], Congress has delegated conditional exercise of this power to the Executive.
We hold that when the Executive exercises this power negatively on the basis of a facially legitimate and bona fide reason, the courts will neither look behind the exercise of that discretion, nor test it by balancing its justification against the First Amendment interests of those who seek personal communication with the applicant.
The majority's decision in Trump v. Hawaii basically applied this logic to another clause of the First Amendment -- here, the Establishment Clause (which normally bars discrimination based on religious denomination, including the use of neutral rules in a discriminatorily motivated way) rather than the Free Speech Clause. The majority could have, of course, changed course and largely rejected the plenary power doctrine, or cut back on it in various ways. It could have concluded that the "bona fide reason" language shouldn't be limited to what the reason "facially" given, and that sometimes the courts should "look behind the exercise of that discretion." It could have argued that the Establishment Clause is different in various ways. Here, for instance, are some distinctions that the dissent offers:
Mandel ... involved a constitutional challenge to an Executive Branch decision to exclude a single foreign national under a specific statutory ground of inadmissibility. Here, by contrast, President Trump ... promulgated an executive order affecting millions of individuals on a categorical basis. Second, Mandel ... did not purport to establish the framework for adjudicating cases (like this one) involving claims that the Executive Branch violated the Establishment Clause by acting pursuant to an unconstitutional purpose. Applying Mandel's narrow standard of review to such a claim would run contrary to this Court's repeated admonition that "[f]acial neutrality is not determinative" in the Establishment Clause context. Finally, even assuming that Mandel ... appl[ies] here, [it] would not preclude us from looking behind the face of the Proclamation because plaintiffs have made "an affirmative showing of bad faith" by the President who, among other things, instructed his subordinates to find a "lega[l]" way to enact a Muslim ban.
But the Court declined these invitations, and basically reaffirmed the plenary power doctrine, at least when it comes to admission of aliens: All that was needed was a facially plausible reason for the governmental decision, and one was provided here (whether or not it's the true reason, or a reason to which the policy is narrowly tailored).
Congress -- and the President, to the extent Congress delegates some such power to the President (as historically it often has) -- gets to decide who comes into the country, with no substantial scrutiny under the Bill of Rights by the courts. One can of course agree or disagree with this, but that's the heart of the majority's position.