From the beginning of his presidency, Donald Trump has been trying to issue a travel ban against people from certain nations — mostly majority-Muslim ones. His original ban was overturned by the federal courts, however, largely because it appeared to be unlawfully discriminatory against Muslims. It was replaced with a second version that was also overturned.

The current ban prohibits most travel to the U.S. by nationals of Iran, Syria, Yemen, Libya, and Somalia, along with some from Venezuela and North Korea. Chad was originally included in the ban but the restrictions have been suspended.

The federal courts continued to be suspicious, but the U.S. Supreme Court made clear that it would have the final say. It stayed lower court injunctions against the application of the ban to people with no “credible claim of a bona fide relationship with a person or entity” in the U.S. and heard oral arguments last fall.

In a 5-4 vote, the Supreme Court has now upheld the ban. Chief Justice John Roberts, writing for the majority, ruled that the Immigration and Naturalization Act gives the President broad authority to exclude foreign nationals from the U.S. whenever he determines they “would be detrimental” to U.S. interests.

Was that authority misused to discriminate against Muslims? The majority decided it was not, based on the “rational basis test” — that the process used to identify the countries to be included in the ban was rational and not obviously based on religious prejudice, the majority concluded, despite numerous statements by the President indicating otherwise.

The countries were identified after the Department of Homeland Security and other agencies reviewed every nation’s information and risk assessment compliance. The countries in the ban failed or refused to provide information on their citizens that was needed to assess the risks they posed. Since these individuals could not be fully vetted, the president could reasonably exclude them on national security grounds.

Roberts noted that the wording of the ban itself is neutral. Only five of the seven currently banned nations are majority Muslim. Moreover, the ban only affects about 8 percent of the world’s Muslim population.

In a scathing dissent, Justice Sonia Sotomayor pointed out that Trump has repeatedly advertised the travel ban as a “total and complete shutdown of Muslims entering the United States.” She accused the majority of “repackaging” the ban as one based on neutral national security concerns and using those concerns to brush aside the plaintiffs’ legitimate First Amendment claims.

If you or a family member are from one of these nations affected by the ban, there may still be options. We urge you to discuss your situation with an immigration law attorney at Yew Immigration Law Group.