Almost every public figure appraising Republican presidential front-runner Donald Trump’s proposed moratorium on Muslim immigration and travel to the U.S. has reacted with horror, but the ban would not necessarily be unconstitutional, experts say.

Recent U.S. immigration history, in fact, is full of examples of discrimination against minority groups. Throughout the Cold War, non-citizen socialists were deported, and gays could be booted as "sexual deviants" until 1990. An entry ban on HIV-positive people wasn't fully repealed until 2010.

Harvard Law School professor Gerald Neuman, co-director of the school’s human rights program, says the idea is “discriminatory in a fashion that’s totally inconsistent with constitutional principles.”

But, he says, “I can see the courts saying the plenary power requires such relaxed judicial review that they would uphold it – it’s possible.”

The plenary power doctrine, explains UCLA law professor Eugene Volokh, “basically says all bets are off, constitutionally speaking, when it comes to admission of aliens to the United States, [and] historically we have discriminated based on race, national origin and speech.”

That historical deference to the political branches, says Volokh, a First Amendment expert, suggests “from a constitutional perspective, it may well be that Muslims could be excluded, just like people could be excluded based on their speech and political opinions, and historically their race."

He cautions "those cases are pretty old, so it’s not clear what the Supreme Court today would authorize.” Applying a travel ban to returning U.S. citizens who are Muslims would clearly be unconstitutional, he says, and Trump’s idea likely would require an act of Congress.

Stephen Yale-Loehr, who teaches immigration law at Cornell Law School, says it's unclear if courts would strike down a ban on Muslim immigrants.

"I could foresee if we had another major terrorist attack by Muslims that Congress would pass a law -- that's a political question and I hope we would never stoop so low," Yale-Loehr says. "I think legally, it could go either way. ... It's not an open and shut case."

Yale-Loehr says "there's a strong deference by the courts to whatever Congress enacts in immigration, however odious, but I would hope that if such a law were ever to be enacted the court would find a way to strike it down," perhaps because religious freedom was a founding principle, though he acknowledges free speech was a founding principle, too.

Republican House Speaker Paul Ryan, R-Wis., denounced Trump’s proposal Monday and it’s unclear how in the current political environment it could pass Congress.

Neuman says that if such a ban does pass, it's conceivable the Supreme Court would allow a lower court ruling against the ban to stand, or that justices would feel compelled to directly weigh in, extending a more active role by federal courts in reviewing exclusion criteria since the 1970s.

Analysis might include international law. “There might be some Supreme Court justices who would be influenced by the fact that this would be a clear violation of U.S. obligations under the [International] Covenant on Civil and Political Rights,” Neuman says.

Aaron Morris, legal director of the organization Immigration Equality, which helps sexual minorities and HIV-positive people immigrate to the U.S., says it’s important for people to recall how the government treated other groups in recent history.

“It’s scary when people start to pick on a particular group,” Morris says. “I hope we’re past that moment in time, where Congress would refuse to do that, but it’s scary that it has happened before.”

The ban on HIV-positive people immigrating to the U.S. passed Congress in the late 1980s, a few years before Congress removed immigration law’s ban on gay people in 1990 – the same year a gay Cuban won a court effort for asylum – and remained in effect until 2010, when regulation eliminated it.

Editorial Cartoons on Donald Trump View All 455 Images

Morris recalls that many HIV-positive people entered the U.S. without knowing about the ban. At-the-border enforcement of a Muslim entry ban would be similarly difficult, as it's not possible to visually evaluate someone's religious beliefs.