When Donald Trump first proposed that the immigration of Muslims be halted temporarily, many suggested — perhaps almost reflexively — that any such move would be illegal.

More recently, when he suggested that being a Muslim might be a factor in decisions affecting national security and protection from terrorism, it was widely suggested — perhaps in some cases by people who think that anything new and different which they oppose must be unconstitutional — that any such policy would violate the U.S. Constitution.

Finally, some have seemingly gone further, and suggested that either policy — or, indeed, any policy which considers religion as a factor — is somehow un-American.

While I am not a supporter of Trump (or of any other politician) nor of any of his specific plans, it is clear to me that all of this labeling is unwarranted and probably incorrect.

Indeed, as a law professor who has sat on the liberal seat on CNN’s Crossfire more often than on the conservative seat, and who has won over 100 legal actions against various different types of illegal discrimination, I write to say that:

I. Limiting or even prohibiting immigration by Muslims is not illegal

II. Considering religion as a factor in formulating anti-terror policy and tactics is not necessarily unconstitutional

III. Profiling — which is widely supported — can hardly be considered to be un-American

I. Limiting or Even Prohibiting Immigration by Muslims Is Not Illegal

Current federal law [Title 8, Section 1182 of the U.S. Code, the Immigration and Nationality Act of 1952] gives the President legal authority to suspend — by a simple proclamation, and without any action by Congress — the entry of “any aliens or of any class of aliens into the United States [who] would be detrimental to the interests of the United States,” and to do so indefinitely. President Obama has in fact already used this power.

This existing statutory grant of authority to the President, and to those to whom he may delegate this power, is very broad, and a very recent Supreme Court decision held that he could withhold visas on national security grounds without providing any reason at all. Thus, even without any action by Congress to give him additional authority, it is likely that the President could at least temporarily ban immigrants who are Muslim.

If Congress were to back this proposal by enacting specific legislation to carry it out, the case for its legality would be even stronger. And there is clear precedent. Indeed, over a period of more than 100 years, Congress has repeatedly limited immigration by many different groups of people seeking admission. The 1924 Immigration Act (targeting those from Southern and Eastern Europe) and the Chinese Exclusion Act (aimed at Chinese) are only two examples.

One simple reason why our country has frequently singled out people by race, nationality, and perhaps even religion for immigration purposes is that we can; because not all the rights guaranteed by the Constitution apply to non-Americans outside the country. Here’s why:

Under what has been called the Plenary Power Doctrine, at least some of the protections guaranteed by the U.S. Constitution do not apply to non-citizens living abroad and seeking admission to the U.S. Law Professor Eric Posner of Chicago Law School described the doctrine this way:

“The Supreme Court has held consistently, for more than a century, that constitutional protections that normally benefit Americans and people on American territory do not apply when Congress decides who to admit and who to exclude as immigrants or other entrants. This is called the plenary power doctrine. The Court has repeatedly turned away challenges to immigration statutes and executive actions on grounds that they discriminate on the basis of race, national origin, and political belief, and that they deprive foreign nationals of due process protections. While the Court has not ruled on religious discrimination, it has also never given the slightest indication that religion would be exempt from the general rule.”

After quoting Prof. Posner, Law Professor Eugene Volokh, of the UCLA School or Law, adds that following: “I would add that, in Kleindienst v. Mandel (1972), the Supreme Court applied the ‘plenary power doctrine’ to the exclusion of people based on their political beliefs, despite the Free Speech Clause. The cases that Posner is referring to, together with Kleindienst, suggest that the exclusion of people based on their religious beliefs is likewise constitutional.”

Moreover, the Supreme Court has repeatedly rejected claims that immigration statutes which discriminate on the basis of race, national origin, or political belief are unconstitutional. Therefore for these reasons, and for some additional ones cited below, it seems very clear — and something few legal scholars would doubt — that the immigration of persons who are Muslims can be halted, at least temporarily, without violating the Constitution.

II. Considering Religion as a Factor in Formulating Anti-terror Policy and Tactics Is Not Necessarily Unconstitutional

So what happens when we try to move beyond the limited area of immigration, where virtually everyone agrees that non-Americans abroad are not entitled to the same constitutional guarantees, and seek to consider religion in making other decisions: e.g., added scrutiny by the TSA when boarding airline flights.

The answer appears to be the same, especially when we consider the crucial difference between racial or religious profiling (which is unconstitutional) and terrorist profiling (which can be constitutional). Failure to understand this crucial difference, and a tendency to think narrowly just in terms of phrases and labeling, is apparently what has led many to overgeneralize, and assume that any consideration of race or religion whatsoever is wrong and unconstitutional, at least when it occurs domestically.

A classic example of unconstitutional racial profiling occurs when police, intent on making a dent in the drug trade, decide to primarily stop African Americans traveling down a major highway, based upon the assumptions that blacks are much more likely to be transporting drugs than whites. If Rastafarians rather than blacks were singled out, it would constitute religious profiling. Both would clearly violate the Equal Protection clause of the U.S. Constitution.

But the U.S. Supreme Court and the U.S. Justice Department have recognized that there are exceptions to the general rule prohibiting decision making based upon factors like race or religion.

The U.S. Supreme Court has held on several occasions that governments may take into account factors such as race (and presumably religion), provided that the decision serves a compelling governmental interest, and that the factor is only one of several considered.

That, after all, is the basis upon which, under so-called affirmative action, the Supreme Court has held that state colleges may discriminate on the basis of race in determining who is to be admitted. They may do so because achieving racial diversity in classrooms is, according to the Court, a compelling state interest. Thus, so long as other factors are also considered, and race is not the sole defining characteristic, it may be considered in making these important governmental decisions.

However, because preventing mass murder by terrorists is at least as much a compelling governmental interest as achieving diversity in the classroom, courts have also recognized that the same exception which permits race or religion to be considered alone with other factors regarding college admissions also applies to preventing terrorism. In summary, while it would be unconstitutional to subject people to additional scrutiny to deter illegal drug sales solely because they happened to be African Americans or Rastafarians. it would not be unconstitutional to single out people for additional terrorism scrutiny based in part on their belief in Islam, provided that other factors were also considered.

This is hardly in doubt. For example, the Department of Justice [DoJ] under President Obama likewise publicly recognizes that, while so-called racial (and similar) profiling is illegal and probably unconstitutional in many situations, exceptions exist with regard to both preventing terrorist attacks, and in controlling who enters the country.

Consider that its recent guidance provides that: “in conducting activities directed at a specific criminal organization or terrorist group whose membership has been identified as overwhelmingly possessing a listed characteristic, law enforcement should not be expected to disregard such facts in taking investigative or preventive steps aimed at the organization’s activities.”

In other words, since terrorists overwhelmingly (but not necessarily all) possess the characteristic of being Muslim, TSA and other law enforcement agencies can consider this factor, among others, “in taking investigative or preventive steps aimed at the organization’s activities.”

In addition, while Justice Department guidelines prohibit as unconstitutional any consideration at all of factors like race or ethnicity in routine police enforcement activities (e.g., traffic stops, drug interdiction, etc.), they did expressly provide that: “in investigating or preventing threats to national security or other catastrophic events (including the performance of duties related to air transportation security) . . . Federal law enforcement officers may not consider race or ethnicity except to the extent permitted by the Constitution and laws of the United States.”

So, since they may not consider race “except to the extent permitted by the Constitution and law of he United States,” there must be some extent to which such consideration is constitutional.

Another major federal agency which has not only recognized that terrorist- (as contrasted with racial-) profiling can be constitutional, but which has also actually engaged in it, is the TSA. It was not selecting for so-called secondary screening all passengers equally — i.e., treating a young Muslim male as presenting the same probability of being a terrorist as an elderly Asian female or a child — but rather deliberately selecting for secondary screening all citizens of 12 named countries. Aside from two communist nations, all of the others have large Muslim populations, including 8 which are at least 90% Muslim.

Since this could hardly be just a mere coincidence, it provides still another example where Americans, believing that it was constitutional to do so, have engaged in religious profiling.

III. Profiling — Which Is Widely Supported — Can Hardly Be Considered to Be Un-American

The idea of profiling Muslims, at least to some extent, can hardly be considered to be un-American, especially when polls show strong support for it; when it is a centerpiece of a political campaign which allowed Trump to overshadow all of his opponents; and when so many other leading political figures generally regarded as mainstream also have expressed support for it.

For example, Governor Jeb Bush stated that the U.S. should “absolutely” be profiling in order to prevent Islamic terrorists from being admitted to the U.S. Senator Ted Cruz has said the U.S. should accept Christian refugees but not Muslims. Rep. Peter King, Chairman of the House Subcommittee on Counterterrorism and Intelligence, said “This is not profiling. This is common-sense policing we have to do.”

Even Hillary Clinton, asked about profiling in the context of “How far do we go, for instance, on airline security?,” answered: “Well I think we have to do whatever it takes . . . . we are in a war situation, and we’re going to have to do things people do in times of war.”

Moreover, President Barack Obama and Democratic Senator Chuck Schumer both said that NYPD’s Ray Kelly would make a good secretary of Homeland Security despite his extensive anti-terrorism programs which many said unnecessarily targeted Muslims and their mosques based solely on religion. So, at least by inference, both Democratic leaders seemed to be endorsing some profiling of Muslims as reasonably necessary to protect us from terrorist attacks.

Something which has widespread (albeit minority) support among both our general population and our political and other leaders can hardly be said to be un-American; a label properly reserved for those ideas or proposals which are so abhorrent that no reasonable American would dare advance them.

Returning to slavery, seeking to exterminate Jews or American Indians, summarily executing anyone thought to be selling drugs, etc. are certainly ideas which properly deserve to be termed un-American. But executing convicted murders, performing abortions within current legal guidelines, possessing so-called assault rifles, hunting animals, etc. cannot rationally be considered un-American, even by those who most strongly oppose them.

Performing abortions is not un-American although many say it constitutes murdering the unborn; executions are not un-American just because many oppose them and consider them to be state-sanctioned murder; and although many would like to ban hunting which they see as barbaric and even bloodthirsty, all recognize that those on the other side have valid arguments, and are not necessarily un-American simply because of a strong disagreement of views on certain issues.

The same seems to be true with regard to restricting the immigration of Muslims and/or considering religion as one factor among several in making decisions regarding programs designed to protect us from terrorists. Those opposed can characterize the proposals as misguided, wrongheaded, and perhaps discriminatory and/or demeaning, but not as so far beyond the pale of rational discourse so as to be called un-American.

IV. Practical Considerations and One Application — Airport Screening

Just because a program or policy is constitutional does not mean it should be put into practice. For example, it may be seen as unfair and unreasonable, as going to far, as too expensive or extreme, or even as counterproductive — for example, many argue that any such policies would alienate American Muslims whose support we urgently need, upset many of our foreign allies with major Muslim population, etc. But is there room for reasonable compromise?

For example, while banning all Muslims from boarding all airplane flights, as a step towards limiting terrorist activity, would probably been seen as unreasonable, excessive, and overkill, making them somewhat more likely to be selected for secondary screening may not be. Both common sense, and a very careful mathematical study based upon the well established science of testing and selections, shows that the current policy of asking young Muslim men to go though secondary screening no more frequently than elderly Asian females — treating them as though both presented exactly the same theoretical or statistical risk — is nonsensical.

Selecting for secondary screening those who have a statically higher probability of being terrorists — e.g., those who are Muslim and/or Arab and/or male and/or a young adult — would make the screening process much more efficient and effective: i.e., more likely to deter terrorists, and to utilize fewer resources and reduce delays.

Those with a very low probability of being terrorists — e.g., elderly Asian females, young children, etc. — would still be subject to some occasional secondary screening, but at a lower rate. Older Muslims, especially females, would be selected somewhat more often, and young Muslim men would be selected the most often.

Furthermore, not all young Muslim males — those whose probability of being selected would be the highest — would have to undergo secondary screening, but it would certainly happen more often that it does now when they are treated the same as elderly Asian females.

For what it’s worth, I at least don’t think such a policy would be unfair or unreasonable, embarrassing or demeaning, etc., and I ask you to consider the following hypothetical. Suppose I, a white person, was living and working in South Africa. Suddenly an extremist group of whites, intent on restoring the country to white rule, begins using suicide bombers to bring down airplanes, and threatens to continue the practice until whites are again in power.

I, as a white person, would certainly hope that secondary screening would be concentrated on white passengers, including me. This would greatly reduce my chances of being blown up in flight. It would also significantly reduce the time I have to spend on security lines at airports because the authorities would not waste as much time on secondary searches of the majority of passengers who are black because there is a very low probability that they would be willing to blow themselves up for the sake of white power.

V. Practical Considerations and a Second Application — Admitting Refugees

It may well be impractical and indeed overkill to ban all non-American Muslims from entering the country, even temporarily. Moreover, although refugees may present a much greater risk than other visitors because their papers and other documentation are more likely to be inconclusive and perhaps even unreliable, it may also be impractical to ban all refugees who are (or appear to be) Muslims, as some people have suggested.

However, in cases where a refugee’s background and possible identity as a terrorist cannot be reliability determined, and their status as a Muslim creates enough anxiety such that they would ordinarily not be admitted, there might be an alternative to completely refusing them admission, or admitting them and thus taking a chance that they might be a terrorist.

For example, rather than barring such Muslims, or ignoring the risks posted by admitting Muslim refugees about whom there isn’t any conclusive evidence, some — especially young males with, for example, prior criminal convictions and/or who have recently visited Syria or other suspect areas — could be given a choice of not being admitted, or of agreeing to wear a ankle GPS-based monitor. Such a device would alert authorities to their location (both in real time, and retroactively during any subsequent investigations), or provide an immediate warning if the device were removed.

Such ankle monitors, which are already widely used in the U.S. for persons suspected (but not proven) of having committed a crime — would substantially reduce a problem law enforcement officials now face — both here and abroad – of lacking sufficient manpower and other resources to keep track of the movements of all persons who are under suspicion of possibly being terrorists, but where there isn’t yet enough evidence to act. The Orlando killer, as well as those in Paris, are clear examples of such situations.

An ankle bracelet which can be covered by trousers during most of the day isn’t terribly demeaning or embarrassing, and wearing it would seem preferable to being denied admission to a country because of suspicions which cannot be resolved. Indeed, in a slight modification of the hypothetical previously proposed, suppose I were a white person seeking to visit or even to settle in South Africa at a time when there was grave concern that any white person might engage in terrorist activities to further the aims of a white separatist group seeking to unseat the current black government.

Given that situation, and a choice of being denied admission to the country or of having to wear an ankle bracelet, I would be overjoyed to be able to choose the latter. Surely my new friends and colleagues in South Africa would understand and probably sympathize with the need to monitor the whereabouts of persons such as myself as to whom there might be any reasonable suspicion. As a law abiding citizen, I would not be greatly troubled if my whereabouts were known and even kept track of. Indeed, while I might much prefer to be admitted without any restrictions, I would probably see an ankle bracelet as a reasonable compromise — the lesser of two evils — that I could understand and live with.

In Conclusion

1. There is little doubt that the U.S. could constitutionally limit immigration based upon religion.

2. Precedents strongly suggest that considering religion as only one of several factors in dealing with the treat of terrorism would likewise not be unconstitutional

3. Profiling based upon religion, although disturbing and objectionable to many, can hardly be considered to be so far beyond the pale as to be un-American, considering that it is supported by so many ordinary Americans, as well as many of their leaders and agencies.

4. There may be compromises regarding this issue which would be acceptable to most Americans, and perhaps even to many Muslims.

UPDATE: After this piece was submitted, the U.S. Supreme Court reaffirmed that it is constitutional to use race (and presumably also factors such as religion) to achieve important government goals. Since preventing terrorist attacks is far more important than increasing classroom diversity beyond that already achieved by the University of Texas in admitting all students who graduated in the top 10% of their high school classes (including overwhelmingly black schools), this decision appears to open the door even wider to considering factors such as religion when reasonably necessary to do so.

John F. Banzhaf III is a nationally-known expert and professor of Public Interest Law at George Washington University Law School. He is a FAMRI Dr. William Cahan Distinguished Professor, a Fellow of the World Technology Network, and the Founder of Action on Smoking and Health (ASH). Follow him on Twitter at @profbanzhaf.