President Donald Trump with the executive order halting immigrants from some majority-Muslim countries from entering the US. Olivier Douliery-Pool/Getty Images President Donald Trump's past comments about a "Muslim ban" and the hasty rollout of his immigration order targeting seven majority-Muslim countries may have undermined the government's legal arguments for upholding the order, law experts say.

On Thursday, the Ninth Circuit denied the government's emergency appeal to lift the Temporary Restraining Order (TRO) on Trump's immigration order issued last week by a federal judge in Seattle, indicating in its opinion that Trump's past comments about a "Muslim ban" can be used as evidence for discrimination.

"It is well established that evidence of purpose beyond the face of the challenged law may be considered in evaluating Establishment and Equal Protection Clause claims," the judges wrote on Thursday.

Legal challenges to presidential executive orders are almost always "an automatic win" for the government, especially when they invoke national-security concerns, said William Stock, the president of the American Immigration Lawyers Association.

But the lawsuits against Trump's immigration order — which Trump has said he would appeal up to the Supreme Court — seem to be an exception for two major reasons, Stock said: "The first is 12 months' worth of statements about a 'Muslim ban.' The second is the president's habitual misstatements of facts and statistics that I really think have caused the court to look upon his claims about the national-security imperative for this order with great skepticism."

In December 2015, Trump called for "a total and complete shutdown of Muslims entering the United States," and former Mayor Rudy Giuliani, of New York, who advised the Trump campaign, told Fox News last week that Trump called him and asked how to carry out a "Muslim ban" "legally."

Trump also told the Christian Broadcasting Network in an interview last month that Syrian Christians would be given priority when applying for refugee status. That promise seems to have been codified in the order, which states that the US will "prioritize refugee claims made by individuals on the basis of religious-based persecution, provided that the religion of the individual is a minority religion in the individual’s country of nationality."

Protesters at Dallas/Fort Worth International Airport in Dallas on January 28 opposing the temporary travel ban imposed by Trump's executive order. Reuters/Laura Buckman The Trump administration has insisted that the "extreme vetting" order signed by Trump in late January does not amount to a "Muslim ban." Lawyers and civil-rights organizations have argued that the ban violates the establishment clause of the First Amendment by "explicitly disapproving of one religion and implicitly preferring others."

Still, experts said those comments were likely to hurt the government's case in the Ninth Circuit Court of Appeals, which heard arguments on Tuesday night over whether the TRO should be upheld while the order's legality is established.

"Those statements are definitely relevant, because there's a longstanding doctrine that there can be laws or executive orders that on their face don't discriminative on the basis of race or religion but that is their motive — and if that is their motive, they can be struck down," Ilya Somin, a George Mason University law professor, told CNN on Tuesday.

Washington state's solicitor general, Noah Purcell, argued before the Ninth Circuit judges on Tuesday that Trump's intention in signing the order was to bar a particular religious group — Muslims — from entering the US and therefore was unconstitutional.

August Flentje, who argued the government's case for the Department of Justice in front of the Ninth Circuit judges on Tuesday, has not disputed that Trump and Giuliani made those statements. He said, however, that it was "extraordinary for a court to enjoin the president's national-security decision based on some newspaper articles."

Demonstrators at a rally against the immigration ban at San Francisco International Airport on January 28 in San Francisco. Stephen Lam/Getty

It is unclear whether the comments will be enough to ensure victory for the plaintiffs as the lawsuit continues to move through the courts. Because the ban does not explicitly mention "Islam" or "Muslims," it may be shielded from legal challenges arguing that it violates the Constitution's guarantee of religious freedom.

Michael McConnell, the director of the Constitutional Law Center at Stanford Law School who formerly served as a judge on the 10th Circuit Court of Appeals, said "evidence of subjective bad motivations" on the part of the executive might not be enough to question an otherwise "neutral" government action.

"The general principle is that government action that is neutral and nondiscriminatory cannot be impugned because of evidence of subjective bad motivations on the part of legislators (or in this case, the executive)," McConnell said in an email. "There are some establishment clause cases to the contrary, but the establishment clause does not apply to actions taken abroad in relation to other nations."

Recourse in a hasty rollout

If Trump's past comments about a ban on Muslims don't weigh heavily on the judges' perceptions of his motivations, the speed with which the order was drafted and rolled out — largely bypassing the government's traditional national-security apparatus — and the extent to which it has been altered since may give courts reason enough to wonder whether an "ulterior motive" was at play, Stock said.

The Ninth Circuit wrote that "in light of the Government’s shifting interpretations of the Executive Order, we cannot say that the current interpretation by White House counsel, even if authoritative and binding, will persist past the immediate stage of these proceedings."

The immigration order originally prevented US green-card holders from one of the seven targeted countries — Iraq, Syria, Iran, Sudan, Libya, Somalia, and Yemen — from being allowed into the US. The White House ammended that one day later, however, to allow those with legal immigration status who had been detained at airports to be released.

Reports emerged in the days after the order was signed that Department of Homeland Security staff members were allowed to see the order only after Trump signed it, and National Security Council lawyers were prevented from evaluating it. The State Department and the Department of Defense were also excluded from the process, NBC reported.

Homeland Security Secretary John Kelly said in a press conference late last month that he knew the executive order "was coming" but would not comment on whether he saw the full document before Trump signed it.

"People on my staff were generally involved" in drafting the order, Kelly said, noting that he thought the order was "fairly clear."

Demonstrators at the Tom Bradley International Terminal at Los Angeles International Airport on January 28. Associated Press/Reed Saxon

"It's not too difficult to portray the policy as just being flat-out irrational," Temple University law professor Peter Spiro told CNN on Monday. "There are lots of elements of the story that cast doubt on the efficacy of this law, the way in which it was adopted, whether it would advance any counterterror objectives — it just all looks bad."

Indeed, the courts are more likely to focus on whether there is "an adequate factual basis for singling out these specific countries as distinct sources of risk," Richard Pildes, a professor of Constitutional Law at New York University, told Business Insider in an email.

Critics of the order have noted that the countries it targets seem arbitrary, and do not include countries that have posed serious terror threats in the past such as Pakistan, Saudi Arabia, Egypt, and the United Arab Emirates.

The immigration order cites the September 11, 2001, terrorist attacks three times as justification for the ban, but the 9/11 hijackers were from Egypt, Saudi Arabia, the United Arab Emirates, and Lebanon.

Activists hold signs as they listen during a news conference in front of the Capitol February 1, 2017 on Capitol Hill in Washington, DC. U.S. Alex Wong/Getty Images

Trump has argued that the seven countries named in the executive order "are the same countries previously identified by the Obama administration as sources of terror." The DOJ similarly claimed in its filing to the US Court of Appeals that the listed countries had "a previously identified link to an increased risk of terrorist activity."

But the Ninth Circuit judges expressed skepticism of Trump's use of Obama's policy to justify his immigration ban.

"Although the Government points to the fact that Congress and the Executive identified the seven countries named in the Executive Order as countries of concern in 2015 and 2016, the Government has not offered any evidence or even an explanation of how the national security concerns that justified those designations, which triggered visa requirements, can be extrapolated to justify an urgent need for the Executive Order to be immediately reinstated," the judges wrote.

"We cannot conclude that the Government has shown that it is 'absolutely clear that the allegedly wrongful behavior could not reasonably be expected to recur,'" the judges wrote.

Stock, of the American Immigration Lawyers Association, said that "all three judges were clearly influenced by the lack of any evidence of imminent danger in the record before the court, as well as the apparent lack of process within the Executive Branch for making such a far-reaching decision."

So far, the government has had difficulty proving that citizens from the seven targeted countries pose an elevated terror risk over others. Judge Michelle T. Friedland, who was appointed by President Barack Obama and was one of three judges from the Ninth Circuit presiding over the immigration-ban case, asked Flentje, the DOJ lawyer, whether the government had any evidence connecting the seven nations targeted by the order to terrorism.

Flentje replied that the record of the case, so far, did not include any such evidence.

"The proceedings have been moving very fast," he said.