Seattle: Federal law gives the president broad authority over immigration. Jimmy Carter used it to deny some Iranians entry to the US during the hostage crisis, Ronald Reagan to bar Cubans who didn't already have relatives here and President Barack Obama to keep out North Korean officials.
So why does President Donald Trump keep running into legal trouble with his efforts to freeze immigration by refugees and citizens of some predominantly Muslim nations?
When federal courts in Hawaii and Maryland blocked Trump's revised travel ban from taking effect, the judges spelled out their major concern: the unusual record of statements by the president and his advisers suggesting the executive order's real purpose was to discriminate against Muslims, in violation of the Constitution's ban on officially favouring or not favouring any religion.
As the legal fight moves into the appeals courts, two key issues will be the extent of the president's broad immigration powers - and whether Trump's own record stymies his plans.
Neither US District Judge Theodore Chuang in Maryland nor Judge Derrick Watson bought the administration's reasoning that the travel ban is about national security.
"The history of public statements continues to provide a convincing case that the purpose of the second executive order remains the realisation of the long-envisioned Muslim ban," Chuang wrote.
Watson criticised what he called the "illogic" of the government's arguments and cited "significant and unrebutted evidence of religious animus" behind the travel ban. He also noted that while courts should not examine the "veiled psyche" and "secret motives" of government decision-makers, "the remarkable facts at issue here require no such impermissible inquiry."
"For instance, there is nothing 'veiled' about this press release: 'Donald J. Trump is calling for a total and complete shutdown of Muslims entering the United States,'" he wrote, referring to a statement Trump issued as a candidate.
But the scope of the rulings differed. In a challenge brought by Hawaii, Watson blocked the federal government from enforcing its ban on travel from six mostly Muslim countries and its suspension of the nation's refugee program. Chuang only blocked the six-nation travel ban, saying it wasn't clear that the suspension of the refugee program was similarly motivated by religious bias.
A federal judge in Seattle on Thursday ruled that his order blocking Trump's original travel ban does not apply to the revised executive order because there are enough differences between the two.
Judge James Robart noted that Washington and several other states have also asked him to block the revised ban. He said he would rule on that request at a later date.
Speaking Wednesday evening at a rally in Nashville, Tennessee, Trump called the ruling in Hawaii an example of "unprecedented judicial overreach" and said his administration would appeal it to the US Supreme Court. He also called his new travel ban a watered-down version of the first one, which he said he wished he could implement.
"We're going to win. We're going to keep our citizens safe," the president said. "The danger is clear. The law is clear. The need for my executive order is clear."
White House spokesman Sean Spicer said Thursday that the Justice Department was exploring its options, but that it expected to file an appeal of the Maryland ruling with the 4th US Circuit Court of Appeals and to seek clarification of the Hawaii order before appealing to the 9th Circuit.
That circuit is where a three-judge panel unanimously declined to reinstate Trump's original travel ban when it was put on hold by a Seattle Judge last month.
Despite the legal victories for critics of the ban, it's far from clear that they will continue to win. A different panel of judges in the 9th Circuit will probably hear the appeal of Hawaii's case. And on Wednesday, five judges signed a dissent criticising the court's decision not to reconsider and throw out the panel's ruling on the original travel ban.
"Whatever we, as individuals, may feel about the president or the executive order, the president's decision was well within the powers of the presidency," Judge Jay Bybee wrote for the five.
In 1952, with the nation fearful of communist infiltration, Congress gave the president the authority under the Immigration and Nationality Act to take action:
"Whenever the president finds that the entry of any aliens or of any class of aliens into the United States would be detrimental to the interests of the United States, he may ... suspend the entry of all aliens or any class of aliens as immigrants or nonimmigrants, or impose on the entry of aliens any restrictions he may deem to be appropriate," the law says.
That power has been invoked dozens of times. But legal experts say those examples were more limited than what Trump has sought.
Citing a report that reviewed White House administrations going back to Reagan, Chuang noted in his ruling that no president has issued a ban on the entry "of all citizens from more than one country at the same time, much less six nations all at once."
Chuang found that the travel ban likely violated another aspect of federal immigration law, barring discrimination on the basis of nationality in the issuance of immigrant visas. That law was passed in 1965 as part of an effort to end longstanding immigration quotas that had been criticised as racist.
Ultimately, the cases will come down to the ways in which that law and the Constitution constrain the president's authority.
"That's the tug of war that is going to play out and, I suspect, go before the Supreme Court," said Ted Ruthizer, a former president of the American Immigration Lawyers Association. "I think it will be a very seminal decision as to what are the limitations on the executive's powers."...