Pretty much right up through the convention, Donald Trump has continued to talk about a ban on Muslim immigration, specifically from areas beset by terrorist activity, and the media has universally condemned him for his “illegal and unconstitutional proposals.” But just how illegal and unconstitutional are they? This week, Kellan Howell at Circa looks at some of the history behind other immigration bans and finds scant evidence that presidents – and particularly Congress – can’t do pretty much whatever they want when it comes to deciding who does or doesn’t get into the country.

It’s not the first time a U.S. president has moved to block specific migrant groups from entering the country, and there are loopholes in current federal law that could make Trump’s ban possible. In fact, the last six presidents have shut U.S. borders for certain groups of people. Most famously, Jimmy Carter banned Iranians during the Iran hostage crisis. Carter did this using his executive authority under the 1952 Immigration and Nationality Act, which gives the president the power to deny entry to immigrants that are deemed “unlawful, immoral, diseased in any way, politically radical etc.”

The list goes well beyond Carter. Reagan instituted five separate immigration bans, including the 1986 bar against Cubans coming into the states. And Congress has gone much, much further in the past, all with the blessing of the Supreme Court to set precedent. There was the Chinese Exclusion Act and the World War II ban on entry by Jews fleeing the Nazis. Nobody is pointing to those as particularly shining moments in the nation’s history, but in terms of the legal questions there is very little that either Congress or the President couldn’t do absent some drastic new precedent in the courts.

Of course, you can’t actually have a ban on Muslims but it’s not because of some legal barrier to doing so. The reality is that you can’t identify people by religion unless they choose to divulge their faith to you or you can spend the time to track down their entire history in whichever overseas hamlet they hail from and ask everyone where they went to church. But could you, for example, ban everyone coming from Iraq or Syria? There seems little doubt that you could and we’ve done the exact same thing in the past.

Just some food for thought now that we have an official nominee for the presidency and he will no doubt be talking about it as we move forward.