Lower federal courts had consistently ruled that the president's behavior was animated by an anti-Muslim bias — a bias he forcefully articulated during the presidential election campaign — concluding that what appeared to be, on its face, a travel ban based rationally on national security needs was in reality a "Muslim ban" based on religious fear, prejudice or hatred.
The Supreme Court unanimously saw it differently. Here is the back story.
I have argued for months that both the first travel ban executive order, signed Jan. 27, and the second one, signed March 6, were lawful and constitutional because the courts have ruled that the Constitution gives the president exclusively the final say on foreign policy and because they have ruled that immigration is one of the tools he can use to effectuate that policy. Moreover, Congress has expressly authorized the president to suspend immigration from stated countries for finite periods of time to enhance national security.